String JavaScript Tutorial

Syntax

string.substr(num1, num2)
    string.substr(num)
The substr() method returns the characters starting with the indexed position num1 and counting to num2 characters.
The string's first character is in position 0.
If num1 is a negative number, the string starts from the end of the string to begin the substring extraction.
It is also possible to pass a single index location to the method.