Tell us what’s happening:
Can’t seem to figure out whats wrong with my code, its spiting out -22 as my result (singleVal should be equal to the sum of all items in the array variable is failing to pass). Im sure its some kind of syntax error but please help!!
Your code so far
var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.
singleVal = array.reduce(function(array, singleVal){
return array - singleVal; });
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0
.
Link to the challenge: