Skip to content

Instantly share code, notes, and snippets.

@mreigen
Created November 20, 2017 05:55
Show Gist options
  • Save mreigen/fdeafcc08a9e44d976bd6a8db468c496 to your computer and use it in GitHub Desktop.
Save mreigen/fdeafcc08a9e44d976bd6a8db468c496 to your computer and use it in GitHub Desktop.
Javascript generate alphabet string
function generateAlphabets() {
var alphabets = [];
var start = 'A'.charCodeAt(0);
var last = 'Z'.charCodeAt(0);
for (var i = start; i <= last; ++i) {
alphabets.push(String.fromCharCode(i));
}
return alphabets.join('');
}
@eioo
Copy link

eioo commented May 26, 2021

The best:
const generateAlphabets = () => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

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