You can use string methods and properties in JavaScript. You can use methods and properties on strings as JavaScript takes primitive values as objects when executing them.
String Properties:
Property | Description |
---|---|
constructor | You can get a function that creates objects instance. |
length | You can get the string length in JavaScript by length property. Read More… |
String Methods:
Method | Description |
---|---|
charAt() | You can use the javascript charAt() method to extract character at the specified index(position) from a string. Read More… |
charCodeAt() | You can use charCodeAt() to get the Unicode value of the character of a specified index from a string. charAt javascript method for string returns UTF-16 code which is an integer between 0 and 65535. Read More… |
concat() | You can use concat() method to concatenating of string. The concat() method in JavaScript returns a new string. Read More… |
toUpperCase() | You can use the toUpperCase() method in JavaScript for converting string to upper case. You get the returned value in a new string. Read More… |
toLowerCase() | You can use the toLowerCase() method in JavaScript for converting string to lower case. You get the returned value in a new string. Read More… |
split() | You can use the split() method in JavaScript to convert a string into an array. The split() methods splits a string by separating it into substrings. The split() method returns an array of strings split at every point where separator occurs. Read More… |
replace() | You can use the replace method in JavaScript to replace matched substring from regular expression and a string. This method does not change the string on which it is used. It returns a new string. Read More… |
indexOf() | You can use the indexOf() method in JavaScript to find index i.e position of the first appearance for the specified string. If the specified string is not found in the main string then it returns -1. Read More… |
lastIndexOf() | You can use lastIndexOf() method in JavaScript to find index i.e position of the last appearance for the specified string. If the specified string is not found in the main string then it returns -1. Read More… |
search() | You can use the search() in JavaScript to find index i.e position of the first appearance for the specified string. If the specified string is not found in the main string then it returns -1. Read More… |
slice() | You can use the slice in JavaScript for extracting some part of the string. slice method returns the extracted string in a new string. Read More… |
substring() | You can use the substring in JavaScript for extracting part or subset of a string. substring method returns extracted string in a new string. Read More… |
substr() | You can use the substr() method in JavaScript to extract part or section of the string starting at a specified location to the length of characters to extract. substr method returns extracted string in a new string. Read More… |