JavaScript - The Strings Object
The String object lets you work with a series of characters; it wraps
Javascript's string primitive data type with a number of helper
methods.
As JavaScript automatically converts between string primitives and
String objects, you can call any of the helper methods of the String
object on a string primitive.
Syntax
Use the following syntax to create a String object −
var val = new String(string);
The String parameter is a series of characters that has been
properly encoded.
String Properties
Here is a list of the properties of String object and their description.
Sr.No. Property & Description
length
1
Returns the length of the string.
String Methods
Here is a list of the methods available in String object along with
their description.
Sr.N
Method & Description
o.
charAt()
1
Returns the character at the specified index.
substr() Returns the characters in a string beginning at the specified
2
location through the specified number of characters.
substring()
3 Returns the characters in a string between two indexes into the string.
4 toString() Returns a string representing the specified object.