Use charCodeAt() method to convert char to int in JavaScript.
String.charCodeAt(0);
How to convert char to number in JS Example
HTML example code, the first parameter is the index of the string to convert to an ASCII code.
<!DOCTYPE html>
<html>
<body>
<script>
alert("A".charCodeAt(0);)
</script>
</body>
</html>
Output:
Do comment if you have any doubts or suggestions on this JS char int code.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version