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