If you want to get a random char between a and z in JavaScript:
javascriptlet abc = 'abcdefghijklmnopqrstuvwxyz'; let ran = ~~(26 * Math.random()); let a_z = abc[ran];
In one line of code:
javascriptlet a_z = 'abcdefghijklmnopqrstuvwxyz'[~~(26 * Math.random())];
Alternatively, for uppercase:
javascriptlet A_Z = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[~~(26 * Math.random())];
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.