1). String.indexOf()
This method will return the index within the string of the first occurrence of the specified string value. And it will return -1 if not found.
Output: 6
2). String.lastIndexOf()
Returns the index within the string of the last occurrence of the specified value and it will return -1 if not found.
Output: 0
3). String.match()
Returns a list of matches of a regular expression against a string.
Output: ['H', index: 0, input: 'Hello World', groups: undefined]
4). String.charAt()
Returns a string representing the character at the given index.
Output: H
5). String.concat()
It is used for string concatenation and it returns a new string.
Output: Geeks Help
6). String.endsWith()
It returns true if the string contains the given string value otherwise it returns false
Output: false
7). String.toLowerCase()
It is used to convert the string to lowercase characters and returns a new string.
Output: geeks help
8). String.toUpperCase()
It is used to convert the string to uppercase characters and returns a new string.
Output: GEEKS HELP
9). String.toString()
This string method returns the string representation of the specified object.
Output: Geeks Help
10). String.matchAll()
This string method returns a list of matches of a regular expression against a string.
Output: Object [RegExp String Iterator] {}
11). String.repeat()
This method creates copies of the string according to the specified number and returns a new string.
Output: Geeks Geeks Geeks
12). String.replace()
It replaces the first match of a regular expression in the string replace by a new character and returns a new string.
Output: G#eks Help
13). String.slice()
This method returns a new string containing the characters of the string from the given index to the end of the string.
Output: Help
14). String.split()
This method returns an array of strings split at the given index.
Output: [ 'Geeks', 'Help' ]
15). String.startsWith()
This string method returns true if the string starts with the given string, otherwise, it returns false.
Output: false
16). String.trim()
The trim() method removes whitespace from both sides of a string. And it returns a new string.
Output: Geeks Help
17). String.trimStart()
This string method removes whitespace from the beginning of a string.
Output: Geeks Help
18). String.trimEnd()
This string method removes whitespace from the end of a string.
Output: Geeks Help