Error:

Create new string

var s = 'string';

Check if the string is equal to another string

var s1 = '1';
var s2 = '1';
if (s1 === s2) {
    // do something
}
// or
if (s1.localeCompare(s2) === 0) {
    // do something
}

Compare two strings

// -1 if s1 < s2 (lexically)
//  1 if s1 > s2 (lexically)
//  0 if s1 == s2

var cmpResult = s1.localeCompare(s2);

Get character at index

var s = 'abc';
var secondChar = s[1];
var thirdChar = s.charAt(2);

Get length of the string

var s = '123';
// the result is 3
var len = s.length;

Get substring

var s = 'abcdefghi';
// s1 is 'cd'
var s1 = s.substring(2, 4);
// s2 is 'hi'
var s2 = s.substring(7);
// s3 is 'ghi'
var s3 = s.slice(-3);

Split string using delimiter

var s = 'a,b,c,d';
// a1 is ['a', 'b', 'c', 'd']
var a1 = s.split(',');
// a2 is ['a', 'b']
var a2 = s.split(',', 2);

Split string using regexp

var s = 'a, b,  c , d';
// a1 is ['a', 'b', 'c', 'd']
var a1 = s.split(/\s*,\s*/);
// a2 is ['a', 'b']
var a2 = s.split(/\s*,\s*/, 3);

Split string to characters

var s = '123';
// a is ['1', '2', '3']
var a = s.split('');

Remove part of the string

// add cut method
String.prototype.cut= function(idx_from, idx_to) {
    return this.substring(0, idx_from)+this.substring(idx_to);
}

// s is '03456789'
var s = '0123456789'.cut(1, 3)

Replace part of the string or insert substring to the string

// Add splice method
String.prototype.splice = function( idx, remove, news ) {
    return (this.slice(0,idx) + news + this.slice(idx + Math.abs(remove)));
};
// s1 is '01ABC456789'
var s1 = '0123456789'.splice(2, 2, 'ABC');
// s2 is '01ABC23456789'
var s2 = '0123456789'.splice(2, 0, 'ABC');

Replace all occurences of the substring

// s is 'aaddefgbc'
var s = 'abcdefgad'.replace(/bc/g,'ad')

Remove all occurences of the substring

// s is 'adefg'
var s = 'abcdefgbc'.replace(/bc/g,'')

Remove all occurences of character set

// remove all vowels
// s is 'bcdfgh'
var s = 'abcdefghi'.replace(/[aeoui]/g,'')

Convert char to Unicode code

// ch1 is 65
var ch1 = 'A'.charCodeAt(0);
// ch2 is 223
var ch2 = 'ß'.charCodeAt(0);

Convert Unicode code to char

// s is 'Aß'
var s = String.fromCharCode(65, 223);

Process string one character at a time

for (var i = 0; i < s.length; i++) {
    // process s[i]
}

Reverse string by character

// r is 'dcba'
var r = 'abcd'.split('').reverse().join('');

Reverse string by word

// r is 'Four Thre Two One'
var r = 'One Two Thre Four'.split(/\s+/).reverse().join(' ')

Uppercase string

// s is 'ONE TWO'
var s = 'One Two'.toUpperCase()
// See also toLocaleUpperCase

Lowercase string

// s is 'one two'
var s = 'One Two'.toLowerCase()
// See also toLocaleLowerCase

Capitalize all words

String.prototype.capitalize = function() {
    return this.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); });
};
// s is 'One Two'
var s = 'one two'.capitalize();

URL-encode the string

// encoded is '%2Ftest%2F'
var encoded = encodeURIComponent('/test/');

URL-decode the string

// decoded is '/test/'
var decoded = decodeURIComponent('%2Ftest%2F');

Trim blanks from the both ends of a string

String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');};
// s is 'one two'
var s = ' one two '.trim();

Trim blanks from the beginning of a string

String.prototype.ltrim=function(){return this.replace(/^\s+/g, '');};
// s is 'one two '
var s = ' one two '.ltrim();

Trim blanks from the end of a string

String.prototype.rtrim=function(){return this.replace(/\s+$/g, '');};
// s is ' one two'
var s = ' one two '.rtrim();

Trim newlines from the ends of a string

String.prototype.chomp=function(){return this.replace(/\n+$/g, '');};
// s is 'one two'
var s = 'one two\n\n\n'.chomp();

Find position of the substring

// idx is 4
var idx = 'one two three'.indexOf('two');

Check if the string contains another string

// has is false
var has = ('one two three'.indexOf('woot') !== -1)

Check if the string starts with another string

String.prototype.startsWith=function(str){return (this.indexOf(str) === 0);};
// b is true
var b = 'one two'.startsWith('one');
// b is false
b = 'one two'.startsWith('two');

Check if the string ends with another string

String.prototype.endsWith=function(str){return this.indexOf(str, this.length - str.length) !== -1;};
// b is false
var b = 'one two'.endsWith('one');
// b is true
b = 'one two'.endsWith('two');

Convert the string to integer

// i is 1000
var i = parseInt("1000", 10);
// h is 255
var h = parseInt("ff", 16);

Convert the string to float

var f = parseFloat("10.01");

Convert float value to string

var f = 1.25;
// s is '1.25'
var s = f.toString();

Convert integer value to string

var n = 99;
// s is '99'
var s = n.toString();

Enumerate all words in the string

var line = 'one two three';
var words = line.split(/\s+/);
for (var i in words) {
    console.log(words[i]);
}