Standard built-ins

String.prototype.charCodeAt()

Try the free JavaScript compiler

Returns the numeric value of the UTF-16 unit at an index; invalid bounds yield NaN.

Formal Syntax & Structure

javascript syntaxjavascript
text.charCodeAt(index)

Parameters & Attributes

NameTypeDescription
indexNumberIndex converted to an integer.

Return Value

Number

Unit value 0–65535 or NaN.

Working Example

Example Snippetjavascript
console.log("A".charCodeAt(0));
JavaScript Reference