All String Methods In JavaScript
String Methods are methods that are used to manipulate strings in JavaScript. They are used to convert strings to other formats or perform operations like search, replace, split, join, etc.
charAt in JavaScript
The charAt() method returns the character at the specified index in a string. It is used to get the character at a particular index in a string.
charCodeAt in JavaScript
The charCodeAt() method returns the Unicode value of the character at the specified index in a string. It accepts a single parameter, the index of the character.
JavaScript concat string
The concat() method is used to join two or more strings. It accepts a variable number of arguments and returns a single string by joining them.
JavaScript endsWith Method
The endsWith() method determines whether a string ends with the characters of a specified string or not. It returns true if the string ends with the specified characters, otherwise, it returns false.
JavaScript includes() Method
The includes() method is used to determine whether a string contains the characters of a specified string, or not. It returns true or false based on the result.
indexOf() String Method
The indexOf() method returns the index of the first occurrence of a specified value in a string. It accepts a single parameter, the value to search for.
lastIndexOf() String Method
The lastIndexOf() method is just like the indexOf method but it returns the index of the last occurrence of the specified value in a string.
JavaScript match() Method
The match() method is a very advanced method. It searches a string for a match against a regular expression, and returns the matches, as an array, or null if no match was found.
JavaScript matchAll() Method
The matchAll() method is the same as the match() method but it returns all the matches even if you use a string as a matching pattern. While using a regular expression, it is necessary to use the flag g with it.
JavaScript repeat() Method
The repeat() method is used to repeat a string a specified number of times. It returns a string consisting of the specified number of copies of the string on which it is called.
JavaScript replace() Method
The replace() method is a very useful string method. It searches a string for a specified value, or a regular expression, and returns a new string where all instances of the specified value have been replaced.
JavaScript replaceAll() Method
The replaceAll() method is the same as replace() method with the difference that it replaces all the matches instead of just the first one. More in detail...
String search() Method
The string search() method is used to search a string for a specified value or a regular expression and returns the position of the match, or -1 if no match was found.
String slice() Method
The string slice() method is used to extract a part of a string and returns a new string. It accepts two parameters, the start index and the end index of the part of the string to extract.
split() Method In JavaScript
The split() method is used to split a string into an array of substrings at the specified separator and returns the array of substrings.
substring() and substr() Method In JavaScript
The substring() and substr() methods are used to extract a part of a string and return a new string. Click here to learn in detail.
JavaScript startsWith() Method
The startsWith() method is used to check if a string starts with the specified string. It can do the same thing for any position of the string when the position is specified as the second parameter.
JavaScript toUpperCase()
The toUpperCase() method is used to convert a string to uppercase. It returns a new string with all the characters in uppercase.