Returns the length of a string.
var str = "Hello, World!";
var length = str.length;
Combines two or more strings.
var str1 = "Hello,";
var str2 = " World!";
var result = str1.concat(str2);
Converts a string to uppercase.
var str = "Hello, World!";
var upperCaseStr = str.toUpperCase();
Converts a string to lowercase.
var str = "Hello, World!";
var lowerCaseStr = str.toLowerCase();
Extracts part of a string between two specified indices.
var str = "Hello, World!";
var subStr = str.substring(0, 5);
Returns the position of the first occurrence of a specified substring in a string.
var str = "Hello, World!";
var position = str.indexOf("World");
Replaces a specified substring with another string in a string.
var str = "Hello, World!";
var newStr = str.replace("World", "Universe");
Removes whitespace from both ends of a string.
var str = " Hello, World! " ;
var trimmedStr = str.trim();