← Back to Question List
JavaScript Code Walkthrough #6
reduce to a Sum
📄 Code
Read carefully — what does this print?1const nums = [1, 2, 3, 4];2const total = nums.reduce((acc, x) => acc + x, 0);3console.log(total);