How to use String charCodeAt() to get char code at index

Char code at index

charCodeAt() accepts zero-based position as its only parameter and returns the character's character code at the given position:

Example


var stringValue = "hello world"; 
        
console.log(stringValue.charCodeAt(1)); //101

The code above generates the following result.





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window