How to use index to access char in a String

char index

We can access an individual character with bracket notation and a numeric index:

Example


var stringValue = "hello world"; 
console.log(stringValue[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