The following statement will extract five characters from the original string, starting at index position 2
var Str2 = Str1.substr(2, 8);
var Str4 = Str1.substr(2);
var Str5 = Str1.substr(2, -3); var Str6 = Str1.substr(2, 0);
Next, we used negative indexing. The following statement starts extracting from -3 (index position of 3 from right to left) and ends at last position.
var Str7 = Str1.substr(-3);