Skip to content

How to get the Alphabet as Array in Javascript

If you need to get an array of alphabetical letters in Javascript then you can use one of the following:

Option 1 – Explicitly define the array first

const alphabet = ["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"];
Code language: JavaScript (javascript)

Option 2 – Split a string of alphabetical characters

const alphabetArray = "abcdefghijklmnopqrstuvwxyz".split("");
Code language: JavaScript (javascript)

Option 3 – Split a string and UpperCase characters

const alphabetArrayUp = toUpperCase("abcdefghijklmnopqrstuvwxyz").split("");
Code language: JavaScript (javascript)

See also  How to use Google Analytics in AngularJS
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x