JavaScript String Functions

The JavaScript String Objects provide various Functions and Constants / Properties. JavaScript String Functions allow us to perform many functionalities such as comparison, search, conversions, extraction, manipulation, case conversions, etc.

String Properties

The following table will show the list of JavaScript Properties or Constants in String function Objects.

PropertiesDescription
constructorIt will return the String Constructor.
lengthThis property will find the length of a given string
prototypeThis will allow to add references (Properties and methods) to the object.

JavaScript String Functions

The following table will show the list of JavaScript String Functions available in String Object.

FunctionsDescription
chartAt()This method will help to join more than one string and return the new one.
charCodeAt()It returns the Unicode of the Character at a specified index position.
concat()Search for a specified string and return the index position of the match. It will return -1 if it is not found.
fromCharCode()This method converts the Unicode values to Characters.
indexOf()Returns the index position of the first occurrence. It will return -1 if it is not found.
lastIndexOf()This JavaScript string function returns the index position of the last occurrence of a specified string. It will return -1 if it is not found.
localeCompare()It will check whether two strings are equivalent in the current locale.
match()Search for the specified value and returns the match.
replace()This method will search for a specified substring and replace it with the new value.
search()It returns the early value of the argument.
slice()Extract the part of it based on the specified indices.
split()It will Split the string into an Array of Substrings based on the separator.
substr()This JavaScript string function will extract the characters based on the Starting position and length.
substring()Extract the characters based on the indices.
toLocaleLowerCase()It will convert into Lowercase letters by considering the host environment’s current locale.
toLocaleUpperCase()Convert into Uppercase letters by considering the host environment’s current locale.
toLowerCase()It will convert into Lowercase letters
toString()It will convert the given value into a String Object
toUpperCase()Convert the given string into Uppercase letters
trim()It will remove the white spaces from both ends
ValueOf()JavaScript string functions return the early value of the argument.

TIP: Please refer HTML Wrapper Methods article. It helps to understand the HTML wrapper methods available in JavaScript Programming.