I have this code here that I've set up:
var numbers = [1,2,3,4,5,6,7,8,9,2,3,4,5,6,1,2,3,4,5,6,7,8,8,4,3,2];
var greaterThan3 = numbers.filter (item => item >= 3);
console.log(greaterThan3);
greaterThan3.reduce((item, amount) => item + amount);
but it only gives me this:
[3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 3, 4, 5, 6, 7, 8, 8, 4, 3]
And, I know it probably has something to do with how I set up the .reduce()
line. I'm trying to get the numbers greater than or equal to 3 to add up to one number. I'm assuming I have to define total and amount but I'm not sure. Just learning this chapter from Bloc so excuse the probably dumb question.