String.charCodeAt

charCodeAt — Returns the numeric Unicode value of the character at the given index.

Description

String.charCodeAt(integer index)

Parameters

Name Description Type Default Optional
index From 0 to string lenght - 1 integer No

Return values

number primitive.

Examples

Example #1 – charCodeAt example
var str = new String('Foo Bar'); console.log(str.charCodeAt(4)); // Will return 66. console.log(typeof str.charCodeAt(4)); // Will return number.

External references