Debugging: Catch Unclosed Parentheses, Brackets, Braces and Quotes problem

let myArray = [1, 2, 3];
let arraySum = myArray.reduce((previous, current =>  previous + current));
console.log(`Sum of array values is: ${arraySum}`);

I get error: Your code should fix the missing piece of the


method. The console output should show that “Sum of array values is: 6”.

Any ideas?

an hint: if I put this in the browser console this error comes up:

VM58:2 Uncaught ReferenceError: previous is not defined

so you probably needs to look around there for your issue. Maybe check what is the syntax for reduce()

Thank you for the reply.

what this means?

previous, current => previous + current

have you tried checking the documentation?

Thank you for your reply.

I read the documentation and didn’t figure it out. Can you explain to me, what the following means?

Try to research how to properly define two parameters using JavaScript arrow function syntax. previous, current => previous + current is not the correct syntax.

Hint: In regular function syntax, what surrounds the parameters in a function’s definition?

Thank you for your reply.