contents   index   previous   next



String charAt()

syntax:

string.charAt(position)

where:

position - offset within a string.

 

return:

string - character at position

 

description:

This method gets the character at the specified position. If no character exists at location position, or if position is less than 0, then NaN is returned.

 

see:

String charCodeAt()

 

example:

// To get the first character in a string,

// use as follows:

 

var string = "a string";

string.charAt(0);

 

// To get the last character in a string, use:

string.charAt(string.length - 1);

 


String charCodeAt()