JavaScript – String prototype Property
The String prototype property allows the addition of new properties and methods to strings.
The String prototype property allows the addition of new properties and methods to strings.
The String repeat() method returns a new string with a number of copies of an existing string, without changing the original string.
The String replace() method searches a string for a value or a regular expression, and returns a new string with the values replaced.
The String search() method matches a string against a regular expression, returning the position of the first match or -1 if no match is found.
The String slice() method extracts a part of a string, returning the extracted part as a new string, without changing the original string.
The String split() method splits a string into an array of substrings, and returns a new array, without changing the original string.
The String startsWith() method returns “true” if a string starts with a specified string, if not, it returns “false”.
The String substr() method extracts characters from a string starting at a specified position, returning the extracted part as a new string.
The String substring() method extracts characters from a string, between two positions, returning a substring, while not changing the original string.
The String toLocaleLowerCase() method converts a string to lowercase letters, using the current locale, without changing the original string.
The String toLocaleUpperCase() method converts a string to uppercase letters, using the current locale, without changing the original string.
The String toLowerCase() method converts a string to lowercase letters, without changing the original string.
The String toString() method returns a string object as a string, without changing the original string.
The String toUpperCase() method converts a string to uppercase letters, without changing the original string.
The String trim() method removes whitespace from both sides of a string, without changing the original string.
The String trimEnd() method removes whitespace from the end of a string, without changing the original string.
The String trimStart() method removes whitespace from the beginning of a string, without changing the original string.
The String valueOf() method returns the primitive value of a string, without changing the original string.
This is a quick reference list of JavaScript string methods and properties with examples of how they are used.
The [attribute$=value] selector selects every element with a specific attribute that has a value ending in a specified string.