Tell us what’s happening:
I looked at the other posts made about this, but none were complete. I can’t get the correct output. I appear to use reduce right otherwise, just not correct in the math and I can’t see how! Thanks in advance!
Your code so far
var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.
singleVal = array.reduce(function(previousVal,currentVal){
return currentVal - previousVal;
}, 0);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10176.76.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.190 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/condense-arrays-with-reduce