Its syntax is:
An Index should be greater than 0 and less than the length of the string. If you will not specified any index value, it will takes the default value 0.Unicode code points range from 0 to 1,114,111. The charCodeAt() will always return a value that is less than 65,536.
Here is the code:
var st=new String("Welcome to this page");
document.write("The Unicode of the character at position 1 is: "+st.charCodeAt(1));
document.write("The Unicode of the character at position 2 is: "+st.charCodeAt(2));
<h2>Use of method charCodeAt()</h2>
<button onclick="charcterCode();">Character Code</button>
Output will be displayed as:
On clicking the button you will get the Unicode of the required character:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.