JavaScript String Functions

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

JavaScript String Properties

The following table will show you the list of Properties or Constants available in JavaScript String Object

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

JavaScript String Functions

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

JavaScript String FunctionsDescription
chartAt()It returns the Character at specified index position
charCodeAt()It returns the Unicode of the Character at a specified index position
concat()This method will help you to Join more than one string and return the new one.
fromCharCode()This JavaScript string functions convert the Unicode values to Characters
indexOf()Returns the index position of the first occurrence. It will return -1 if it not found
lastIndexOf()This JavaScript string functions returns the index position of the last occurrence of a specified string. It will return -1 if it 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 JavaScript string functions will search for a specified substring and replace it with the new value
search()Search for a specified string and return the index position of the match. It will return -1 if it not found
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 functions 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 String Object
toUpperCase()Convert the given string into Uppercase letters
trim()It will remove the white spaces from both ends
ValueOf()JavaScript string functions returns the primitive value of the argument.

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