Knowledge Walls
Laya
Hyderabad, Andhra Pradesh, India
String.prototype.charCodeAt() Method in String Class of Javascript Syntax with Examples
2821 Views
Usage 
charCodeAt(int index) return the unicode value of the character in specified index of the string.
Syntax 
String.charCodeAt(int index);

index - specify which position character needs to take from the string. index is starting from zero.
Example
var userName = "kumar";

//Returns chartacter unicode value at 2 index which means `109`.
var char1 = userName.charCodeAt(2);
document.write("character unicode value is "+char1+" at 2.");

//No characters unicode value at 54 index So returns empty character
var char2 = userName.charCodeAt(54);
document.write("character unicode value is "+char2+" at 54.");
Output 
character unicode value is 109 at 2.
character unicode value is at 54.
Next Topics
Next lessons of current book.
Best Lessons of "Javascript Syntax with Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details