Skip to content

JavaScript char to int | Example code

  • by

Convert char to int using charCodeAt method in JavaScript. Take first char of the string to convert to an ASCII code.


Complete code

<!DOCTYPE html>




JavaScript char to int

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

Leave a Reply

Your email address will not be published. Required fields are marked *