charCodeAt Method (String)

charCodeAt Method (String) (JavaScript)

 

Returns the Unicode value of the character at the specified location.

strObj. charCodeAt(index)

strObj

Required. Any String object or string literal.

index

Required. The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.

The following example illustrates the use of the charCodeAt method.

var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
document.write(str.charCodeAt(str.length - 1));

// Output: 90 

Requirements

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Show:
© 2016 Microsoft