Play-Asia.com - Buy Video Games for Consoles and PC - From Japan, Korea and other Regions!

Javascript - String.charCodeAt()

 

Syntax

string.charCodeAt(num)

Description

The charCodeAt() method of an instance of the String object returns the ISO-Latin-1 number of the character located at the indexed, num, position passed. This indexing is done from left to right starting with the 0(zero) position. If the num passed is not a valid index in the string, -1 is returned.

Example

<script language="JavaScript">
<!--

var myString = new String("abc defg");

document.write(myString.charCodeAt(2)); //result is '99'
document.write(myString.charCodeAt(7)); //result is '103'
document.write(myString.charCodeAt(9)); //result is NaN

//-->
</script>
              

 

 
Visitor Review Write a review
No visitor review for this page yet
Write a review
Rating:
Text:
Name:
Email:
(optional)
 
Code:
 

Search:
Shopping Store Online
Clothes (26)
Gift shop (69)
Hand-made (27)
Luxuries (47)
Others (44)
Programming Tutorial
ASP (14)
CSharp (29)
HTML (12)
JavaScript
charAt method
charCodeAt method
concat method
indexOf method
lastIndexOf method
replace method
Photoshop (10)
PHP (11)
Entertainment
Anime (6)
E-Cards (12)
Games (20)
Music (9)