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 peterkingsbury/c299847c42b5d899d1316d368a896774 to your computer and use it in GitHub Desktop.
Save peterkingsbury/c299847c42b5d899d1316d368a896774 to your computer and use it in GitHub Desktop.
Get the sum of the ASCII values of a string of text, in a single line of JavaScript
'hello, world'.split('').reduce((prev, curr) => { return prev + curr.charCodeAt(0); }, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment