Microsoft® JScript™ charAt Method | Language Reference Version 1

See Also Applies To

##### Description

> Retrieves the character at the index specified.

##### Syntax

> strVariable.charAt(index)
> "String Literal".charAt(index)

> The index argument is the zero-based index of the desired character. Valid values are between 0 and the length of the string minus 1.

##### Remarks

> The charAt method returns a character value equal to the character at the specified index. The first character in a string is at index 0, the second is at index 1, and so forth. Values of index out of valid range return undefined.

> The following example illustrates the use of the charAt method:

> >     function charAtTest(n)
> >     {
> >       var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
> >       var s;
> >       s = str.charAt(n - 1);
> >       return(s);
> >     }

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.