how to make an alphabet in javascript
// To get an array of letters from 'a' to 'z' in javascript.
let alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
how to make an alphabet in javascript
// To get an array of letters from 'a' to 'z' in javascript.
let alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');
javascript alphabet to number
function convertLetterToNumber(str) {
str = str.toUpperCase();
let out = 0, len = str.length;
for (pos = 0; pos < len; pos++) {
out += (str.charCodeAt(pos) - 64) * Math.pow(26, len - pos - 1);
}
return out;
}
convertLetterToNumber("A"); // 1
convertLetterToNumber("b"); // 2
convertLetterToNumber("Ba"); // 53
convertLetterToNumber("dE"); // 109
convertLetterToNumber("ZZZZ"); // 475254
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us