Skip to content

Instantly share code, notes, and snippets.

@kounelios13
Last active August 29, 2018 11:59
Show Gist options
  • Save kounelios13/1beede9a9cb662274e1d116e4bbc7744 to your computer and use it in GitHub Desktop.
Save kounelios13/1beede9a9cb662274e1d116e4bbc7744 to your computer and use it in GitHub Desktop.
Sum list of numbers
let int = i => parseInt(i,10);
let numbers=prompt("Enter numbers seperated by comma").split(',').map(Number);
let sum = numbers.reduce((sum,val)=>sum+val);
alert("Sum of numbers = ->"+sum);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment