Javascript replace() Reference

Description:
Searches for a string using regex and replaces string that matches.

Syntax:

string.replace(searchvalue,newvalue)

Examples:

var str = "Dude, where's my car?";
var res = str.replace("Dude", "Bro");
console.log(res); // Bro, where's my car?

To replace all instances:

var str = "Dude, Dude, Dude, where's my car?";
var res = str.replace(/Dude/g, "Bro");
console.log(res); // Bro, Bro, Bro, where's my car?

Javascript match() reference

Description:
Searches for a string using regex and returns an array of results.

Syntax:

string.match(regexp)

Examples:

var str = "The rain in SPAIN stays mainly in the plain"; 
var res = str.match(/ain/gi);
console.log(res); // ain,AIN,ain,ain

Javascript indexOf() Reference

Description:
Returns first occurrence of string, or -1 if not found.

Syntax:

string.indexOf(searchvalue,start)

Examples:

var str = "Welcome to heck.";
var position = str.indexOf("e");
console.log(position); // 1
var str = "My name is Kiiddddd!";
var position = str.indexOf("e", 5);
console.log(position); // 6
var str = "Hello world";
var position = str.indexOf("z");
console.log(position); // -1

Javasacript concat() Reference

Description:
Joins 2 or more strings.

Syntax:

string.concat(string1, string2, ..., stringN)

Examples:

var str1 = "My ";
var str2 = "name is John!";
var res = str1.concat(str2);
console.log(res); // My name is John!
var str1 = "Mich"
var str2 = "ael";
var str3 = " Jackson";
var res = str1.concat(str2, str3);
console.log(res); // Michael Jackson

Javascript charAt() Reference

Description:
Returns a character from string at a position.

Syntax:

string.charAt(index)

Examples:

var str = "Hello world!";
var res = string.charAt(1)
console.log(res); // e
var str = "Michael";
var res = string.charAt( string.length - 1 );
console.log(res); // l

Javascript substr() method Reference

Description:
Extracts part of a string

Syntax:

string.substr(start,length)

Examples:

var str = "Hello world!";
var res = str.substr(2, 4);
console.log(res); // llo
var str = "Michael";
var res = str.substr(-2,1);
console.log(res); // e

Javascript split() method reference

Description
Split a string into an array of substrings.

Syntax

string.split(separator,limit)

Examples

var str = "How are you doing today?";
var res = str.split(" ");
console.log(res); //[How,are,you,doing,today?]
var str = "How are you doing today?";
var res = str.split(" ",3);
console.log(res); //[How,are,you]