substring or substr code example
Example: javascript substring vs substr
var string = "This is a string";
var a = string.substring(2, 5); //Start at index 2 and end at index 5
console.log(a); //output "is "
var b = string.substr(2, 5); //Start at index 2 and stop after 5 characters
console.log(b); //output "is is"