DEV Community

loading...

Javascript: Alphabet as array

Matt Kenefick
Senior Engineer -- Learn to code first. Use libraries second.
・1 min read

Quick and easy way to get alphabetical characters into an array in Javascript.

String.fromCharCode(...Array(123).keys()).slice(97).split('');

// ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
Enter fullscreen mode Exit fullscreen mode


`

Discussion (0)