Pages

Thursday, March 28, 2019

Javascript ASCII code to character and vice versa

For capital letter,

65 = A
66 = B
...
89 = Y
90 = Z

String.fromCharCode(An integer); 
e.g. 
String.fromCharCode(66) will return B
String.fromCharCode(105) will return i (lower case i )

For small letter,

a = 97
b = 98
...
z = 122

'a'.charCodeAt(0) will return 97
'cdef'.charCodeAt(3) will return 102

No comments :

Post a Comment