This method returns a one-character string from index position in a string.

All characters in a string has an index starting with 0 as the first character and length-1 as the last character.

In some implementations you can use a different notation, string [index], to achieve the same.

Return value:

A primitive string.

index:

This is the index of the character that should be returned from a string.

An example of using the charAt() :

<script type="text/javascript">
var str1="This string has a lot of characters";
document.write("The last character of the string is: "+
str1.charAt(str1.length - 1)+"<br>");
// ordocument.write("The last character of the string is: "+
str1[str1.length - 1]+"<br>");
</script>

Syntax:

charCodeAt(index)

Returns a number representing the code point value of the character at
position index in the string.

Return value:

A number or NaN if there is no character at that index position.

index:

This is the index of the character that should be convertet and returned from a string.

An example of using the charCodeAt() :

<script type="text/javascript">
var str1="This string has a lot of characters";
document.write("The last character code of the string is: "+
str1.charCodeAt(str1.length - 1)+"<br>");
</script>

Syntax:

concat([string, string, ...])

When the concat method is called with zero or more arguments string1, string2, etc., it returns a primitive string consisting of the characters of the string followed by the characters of each of string1, string2, etc

Prototype Properties:

This property of the String.prototype holds the reference back to the String object.

Important note:

This is the same as the constructor property of an instantiated object

Syntax:

length

Returns the lenght of the string in amount of characters.

Important note:

The property will be unique for an instantiated object. It is a read only property.

Return value:

A number.

An example of using the length :

<script type="text/javascript">
var str1="This string has a lot of characters";
document.write("The last character of the string is: "+
str1.charAt(str1.length - 1)+"<br>");
// ordocument.write("The last character of the string is: "+
str1[str1.length - 1]+"<br>");
</script>