|
Instance Methods |
Description |
|---|---|
| at() | Find the character at the specified index. |
| anchor() | Creates an anchor element that is used as a hypertext target. |
| charAt() | Returns that character at the given index of the string. |
| charCodeAt() | Returns a Unicode character set code unit of the character present at the index in the string. |
| codePointAt() | Return a non-negative integer value i.e, the code point value of the specified element. |
| concat() | Join two or more strings together in JavaScript. |
| endsWith() | Whether the given string ends with the characters of the specified string or not. |
| includes() | Returns true if the string contains the characters, otherwise, it returns false. |
| indexOf() | Finds the index of the first occurrence of the argument string in the given string. |
| lastIndexOf() | Finds the index of the last occurrence of the argument string in the given string. |
| localeCompare() | Compare any two elements and returns a positive number |
| match() | Search a string for a match against any regular expression. |
| matchAll() | Return all the iterators matching the reference string against a regular expression. |
| normalize() | Return a Unicode normalization form of a given input string. |
| padEnd() | Pad a string with another string until it reaches the given length from rightend. |
| padStart() | Pad a string with another string until it reaches the given length from leftend. |
| repeat() | Build a new string containing a specified number of copies of the string. |
| replace() | Replace a part of the given string with some another string or a regular expression |
| replaceAll() | Returns a new string after replacing all the matches of a string with a specified string/regex. |
| search() | Search for a match in between regular expressions and a |
| slice() | Return a part or slice of the given input string. |
| split() | Separate given string into substrings using a specified separator provided in the argument. |
| startsWith() | Check whether the given string starts with the characters of the specified string or not. |
| substr() | Returns the specified number of characters from the specified index from the given string. |
| substring() | Return the part of the given string from the start index to the end index. |
| toLocaleUpperCase() | Returns the calling string value converted to a uppercase letter. |
| toUpperCase() | Converts the entire string to uppercase. |
| toString() | Return the given string itself. |
| trim() | Remove the white spaces from both ends of the given string. |
| trimEnd() | Remove white space from the end of a string. |
| trimStart() | Remove white space from the start of a string. |
| valueOf() | Return the value of the given string. |
|
string[Symbol.iterator]() |
This method is used to make String iterable. [@@iterator]() returns an iterator object which iterates over all code points of the String. |
| toLowerCase() | Converts the entire string to lowercase. |
| toLocaleLowerCase() | Returns the calling string value converted to a lowercase letter. |
<!DOCTYPE html>
<html>
<head>
<title>JavaScript</title>
<script>
var str = " JavaScript is a Great is Language";
var a = str.length; /* Length Method */
var b = str.toLowerCase(); /* LowerCase Method */
var c = str.toUpperCase(); /* UpperCase Method */
var d = str.includes("ipt"); /* Include Method */
var e = str.startsWith("Java"); /* StartWith Method */
var f = str.endsWith("age"); /* EndWith Method */
var g = str.search("is"); /* Search Method */
var h = str.match(/is/g); /* Match Method */
var i = str.indexOf("is"); /* IndexOf Method */
var j = str.lastIndexOf("is"); /* LastIndexOf Method */
var k = str.replace("JavaScript","PHP"); /* Replace Method */
var l = str.trim(); /* Trim Method */
document.write(a + "<br>");
document.write(b + "<br>");
document.write(c + "<br>");
document.write(d + "<br>");
document.write(e + "<br>");
document.write(f + "<br>");
document.write(g + "<br>");
document.write(h + "<br>");
document.write(i + "<br>");
document.write(j + "<br>");
document.write(k + "<br>");
alert(l);
</script>
</head>
<body>
</body>
</html>