Medium
What will the following code output, and why?
1const numbers = [1, 2, 3, 4];2const result = numbers.reduce((acc, num, index) => {3 if (index === 1) return acc + num * 2;4 return acc + num;5}, 0);67console.log(result);
1const numbers = [1, 2, 3, 4];2const result = numbers.reduce((acc, num, index) => {3 if (index === 1) return acc + num * 2;4 return acc + num;5}, 0);67console.log(result);