How to use String charAt() method to get char in a String

Description

charAt() accepts zero-based position as its only parameter. It returns the character in the given position.

Example


var stringValue = "hello world"; 
console.log(stringValue.charAt(1)); //"e" 

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