1let ascii = 'a'.charCodeAt(0); // 97
2let char = String.fromCharCode(ascii); // 'a'
1var myVar='A';
2var myVarAscii = myVar.charCodeAt(0); //convert 'A' character to it's ASCII code (65)
1const sentence = 'The quick brown fox jumps over the lazy dog.';
2
3const index = 4;
4// return the chartcode of the character with index N°4
5const charcode= sentence.charCodeAt(index);
6console.log (charcode);
7// expected output: "The character code 113 is equal to q"
8
9// remember that charCodeAt return the code on ♦ keypress event ♦