JavaScript charCodeAt() Method

The JavaScript charCodeAt() method returns the Unicode of the character at the specified index in a string.
The index of the first character is start from 0 , second character 1, and so on.

Syntax:

string.charCodeAt(index)
Where, index = required, an integer representing the index of the character you want to return

Example:

var str = “This is JavaScript charCodeAt() Method”;
var n = str.charCodeAt(0);
alert(n);   //OUTPUT :  84

Live Demo:JavaScript charCodeAt() method

Leave a Reply