Convert char to int using charCodeAt method in JavaScript. Take first char of the string to convert to an ASCII code.
String.charCodeAt(0);
Complete code
<!DOCTYPE html>
<html>
<body>
<script>
alert("A".charCodeAt(0);)
</script>
</body>
</html>
Output:

Another example
var chr ='A';
chr.charCodeAt(0); //65
Do comment if you have another example or suggestions or doubts on this JS char topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version