concat()
Description: Combines the text of two or more strings and returns a new string.
Example:
let str1 = 'Hello';
let str2 = 'World';
let result = str1.concat(', ', str2);
console.log(result); // Output: 'Hello, World'
replace()
Description: Searches a string for a specified value, or a regular expression, and returns a new string with the specified values replaced.
Example:
let str = 'Hello, World!';
let newStr = str.replace('World', 'JavaScript');
console.log(newStr); // Output: 'Hello, JavaScript!'
split()
Description: Splits a string into an array of substrings, and returns the new array.
Example:
let str = 'Hello, World!';
let arr = str.split(', ');
console.log(arr); // Output: ['Hello', 'World!']
substring()
Description: Extracts the characters from a string, between two specified indices, and returns the new substring.
Example:
let str = 'Hello, World!';
let substr = str.substring(0, 5);
console.log(substr); // Output: 'Hello'