-
JavaScript String toLocaleLowerCase() method
The toLocaleLowerCase() method in JavaScript is used to convert all the characters in a string to their lowercase equivalent, according to the rules of the current locale. This method does not take any arguments, and returns a new string with all the characters in the original string converted to lowercase. Here is an example of […]
-
JavaScript String startsWith() method
The startsWith() method in JavaScript is used to check whether a string begins with the specified substring. This method takes a single argument, which is the substring to search for at the beginning of the string. If the substring is found at the beginning of the string, the startsWith() method returns true. If the substring […]
-
JavaScript String split() method
The split() method in JavaScript is used to split a string into an array of substrings, based on a specified separator string. This method takes a single argument, which is the separator string to use when splitting the string. The split() method splits the original string at each occurrence of the separator string, and returns […]
-
JavaScript String slice() method
The slice() method in JavaScript is used to extract a part of a string, and return a new string. This method takes two arguments: the start index and the end index of the part of the string to extract. The slice() method extracts the part of the string between the start and end indices, and […]
-
JavaScript String search() method
The search() method in JavaScript is used to search a string for a specified regular expression, and return the position of the match within the string. This method takes a single argument, which is the regular expression to search for in the string. If the regular expression is found, the search() method returns the index […]
-
JavaScript String replace() method
The replace() method in JavaScript is used to search a string for a specified pattern, and replace the pattern with a specified replacement string. This method takes two arguments: the pattern to search for, and the replacement string. If the pattern is found, the replace() method returns a new string with the pattern replaced by […]
-
JavaScript String repeat() method
The repeat() method in JavaScript is used to repeat a string a specified number of times. This method takes a single argument, which is the number of times to repeat the string. If the number of times to repeat the string is a positive integer, the repeat() method returns a new string that is the […]
-
JavaScript String match() method
The match() method in JavaScript is used to search a string for a specified regular expression, and return an array of matched strings. This method takes a single argument, which is the regular expression to search for in the string. If the regular expression is found, the match() method returns an array of matched strings. […]
-
JavaScript String localeCompare() method
The localeCompare() method in JavaScript is used to compare two strings in the current locale. This method takes a single argument, which is the string to compare with the original string. The localeCompare() method returns a number indicating whether the original string comes before, after, or is the same as the string being compared to. […]
-
JavaScript String length property
The length property in JavaScript is used to get the length of a string. This property is a read-only property of strings in JavaScript, and returns the number of characters in the string. Here is an example of how the length property works: In the code example above, we first declare a string called string1 […]