Debugging issue challenge

Tell us what’s happening:
Im getting a message saying that previous is not defined.

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36.

Link to the challenge:

Brackets need to go around the arguments to a function, for example, should be this:

(a, b) => a + b

Not this

(a, b => a + b)

which will do something different, as it assumes you’re writing a, then the comma operator, then a function (b) => a + b

Thanks my man. It worked.

1 Like

:man_facepalming: I’m really sorry about doing that to your post

(Did I correctly get it back in its original state?)

Yup, looks good! Phew, is there a post edit history that I just missed?

If you click the orange pencil you can revert.

Ahhh, yes, that would have saved embarrassment :upside_down_face:

1 Like

No biggie my man. It worked out

1 Like