JavaScript & jQuery Tutorials

JS Home Right Arrow JS Reference Right Arrow String Right Arrow charAt()

charAt()  String  instance method


Returns the character at the specified index.


Signature Description
aString.charAt(index)Returns the character at the specified index.


Parameter Description
indexAn integer between 0 and the length of the string -1.
  • Out of range indexes return an empty string.


The code below creates a string of the alphabet and returns index 19.

// Create alphabet string varible.
var theAlphabet = 'abcdefghijklmnopqrstuvwxyz';
// Return character at index 19 ('t').

Press the button below to action the above code:

Related Tutorials

JavaScript Basic Tutorials - Lesson 8 - Strings


go to home page Homepage go to top of page Top