Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LookOnTheBrightSide/d01e429a15aafc0c2a1a8178f889a193 to your computer and use it in GitHub Desktop.
Save LookOnTheBrightSide/d01e429a15aafc0c2a1a8178f889a193 to your computer and use it in GitHub Desktop.
let numbers = [2, 3, 4, 5, 6, 7];
let reducer = (...nums) => nums.reduce((prev, next) => prev + next)
let total = reducer(numbers)
console.log(`Your lucky number is: ${reducer(1,2,3) + 10}`)
console.log(`The total is ${total}`)
@LookOnTheBrightSide
Copy link
Author

why do I get an array back when I pass in numbers variable? Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment