Created
November 20, 2017 05:55
-
-
Save mreigen/fdeafcc08a9e44d976bd6a8db468c496 to your computer and use it in GitHub Desktop.
Javascript generate alphabet string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The best:
const generateAlphabets = () => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'