eternaloptimist
Well-Known Member
- Joined
- Jul 10, 2013
- Messages
- 175
Hi all
Kinda confused as to why using the variable won't work. Can someone help/explain?
Kinda confused as to why using the variable won't work. Can someone help/explain?
Code:
let numbers = [2, 3, 4, 5, 6, 7];
let reducer = (...nums) => nums.reduce((prev, next) => prev + next)
let total = reducer(numbers)
//this works
console.log(`Your lucky number is: ${reducer(2, 3, 4, 5, 6, 7)}`)
//this does not
console.log(`The total is ${total}`)
Last edited: