Skip to content

Instantly share code, notes, and snippets.

@thetallweeks
Last active August 29, 2015 14:10
Show Gist options
  • Save thetallweeks/fce6269c23f38e1b1def to your computer and use it in GitHub Desktop.
Save thetallweeks/fce6269c23f38e1b1def to your computer and use it in GitHub Desktop.
An array of the alphabet
// From http://stackoverflow.com/a/12377023/1660815
function range(start,stop) {
var result=[];
for (var idx=start.charCodeAt(0),end=stop.charCodeAt(0); idx <=end; ++idx){
result.push(String.fromCharCode(idx));
}
return result;
};
range('a', 'z');
// ["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"]
range('A', 'Z');
// ["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"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment