Convert character to ASCII code in JavaScript
String.prototype.charCodeAt() method in JavaScript returns the ASCII code of a character from a string. It accepts the index of the characters as an argument and returns the ASCII equivalent of it.
let str = "poopcode"; console.log(str.charCodeAt(0)); //112 let str1 = "123"; console.log(str.charCodeAt(0)); //49