Discussion: Alphabet Aerobics
Execute the code to understand the output and gain insights into generating a string of lowercase letters by converting numbers to characters.
We'll cover the following...
We'll cover the following...
Verifying the output
Now, it’s time to execute the code and observe the output.
Press + to interact
Javascript (babel-node)
for(i=9,a='';++i<36;)a+=i.toString(36)console.log(a);
Understanding the output
This JavaScript code is a clever way to create a string containing the English alphabet. It generates a string with lowercase letters by converting each number from 9 to 35 into a character and adding it to a growing string.
Let’s start with the for
loop: for(i=9,a='';++i<
...