Javascript valueOf() Reference

Description:
Returns the primitive value of a string object.

Syntax:

string.valueOf()

Examples:

var string = "I am a string.";
var res = string.valueOf();
console.log(res); // "I am a string."

Javascript trim() Reference

Description:
Removes extra whitespace from the beginning and ending of a string.

Syntax:

string.trim()

Examples:

var string = "   this is a spacious room!  ";
var res = string.trim();
console.log(res); // "this is a spacious room!"

Javascript toUppercase() Reference

Description:
Makes all letters of a string uppercase.

Syntax:

string.toUppercase()

Examples:

var string = "why are we yelling?";
var res = string.toUppercase();
console.log(res); // WHY ARE WE YELLING?

Javascript toString() Reference

Description:
Returns the value of a string object.

Syntax:

string.toString()

Examples:

var string = "WHY ARE WE YELLING?";
var res = string.toString();
console.log(res); // WHY ARE WE YELLING?

Javascript toLowerCase() Reference

Description:
Returns a portion of a string between a starting and ending index.

Syntax:

string.toLowerCase()

Examples:

var string = "WHY ARE WE YELLING?";
var res = string.toLowerCase();
console.log(res); // why are we yelling?

Javascript slice() Reference

Description:
Grabs portions of a string and returns those snippets.

Syntax:

string.slice(start,end)

Examples:

var str = "Billy Jean is not my lover!";
var res = str.slice(1,4);
console.log(position); // lly

Javascript search() Reference

Description:
Searches for a string within a string.

Syntax:

string.search(searchvalue)

Examples:

var str = "My favorite movie is WarGames.";
var position = str.search("favorite");
console.log(position); // 3