JavaScript | JavaScript Functions | Question 3

Last Updated :
Discuss
Comments

What will be the output of the following code?

JavaScript
const arr = [1, 2, 3, 4, 5, 6];
const result = arr.filter(num => num % 2 === 0)
                  .map(num => num * 2)
                  .reduce((acc, curr) => acc + curr, 0);
console.log(result);

24

22

12

18

Share your thoughts in the comments