Answers for "how to get charcter number in js"

5

how to convert char to number in js

// the first parameter is the index of the string to convert to an ascii code
"A".charCodeAt(0);
//output: 65
Posted by: Guest on February-06-2021
3

javascript letters as number

const toChars = n => `${n >= 26 ? toChars(Math.floor(n / 26) - 1) : ''}${'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[n % 26]}`;

// Examples
toChars(0);     // A
toChars(1);     // B
toChars(25);    // Z
Posted by: Guest on July-03-2020

Code answers related to "how to get charcter number in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language