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:
![JavaScript convert char to int Number](https://i0.wp.com/tutorial.eyehunts.com/wp-content/uploads/2021/07/JavaScript-convert-char-to-int-Number.jpg?resize=527%2C181&ssl=1)
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