You are on page 1of 2

String Properties:

Property: Syntax:
Length: This property returns the
number of characters in a string.
string.length
Prototype: The prototype property allows
you to add properties and methods to any object.prototype.name = value
object (Number, Boolean, String, Date, etc.).

String Methods:

Method: Syntax:
charAt():charAt() is a method that returns the string.charAt(index)
character from the specified index.

charCodeAt ():This method returns a number


indicating the Unicode value of the character at
string.charCodeAt(index)
the given index.
concat ():This method adds two or more string.concat(string2, string3[, ...,
strings and returns a new single string.
stringN]);
indexOf (): This method returns the index
within the calling String object of the first
string.indexOf(searchValue[,
occurrence of the specified value, starting the
search at fromIndex or -1 if the value is not fromIndex])
found.
lastIndexOf (): This method returns the string.lastIndexOf(searchValue[,
index within the calling String object of the last
fromIndex])
occurrence of the specified value, starting the
search at fromIndex or -1 if the value is nfound.
localeCompare ():This method returns a
number indicating whether a reference string
comes before or after or is the same as the string.localeCompare( param )
given string in sorted order.
replace () :This method finds a match between a string.replace(regexp/substr,
regular expression and a string, and replaces the
matched substring with a new substring. newSubStr/function[, flags]);
Search ():This method executes the search for a
match between a regular expression and this String
object.. string.search(regexp);
slice ():This method extracts a section of a string.slice( beginslice [,
string and returns a new string. endSlice] );
split (): This method splits a String object
into an array of strings by separating the string
into substrings.
string.split([separator][, limit]);
This method returns the characters in a string
beginning at the specified location through the
specified number of characters.

You might also like