The JavaScript String Objects provide various Functions and Constants / Properties. JavaScript String Functions allow us to perform many functionalities such as String comparison, search, conversions, extraction, manipulation, case conversions, etc.
String Properties
The following table will show you the list of Properties or Constants available in String Object
Properties | Description |
---|---|
constructor | It will return the String Constructor |
length | This property will find the length of a given string |
prototype | This 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
Functions | Description |
---|---|
chartAt() | It returns the Character at the 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 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 functions 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() | 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 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 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.