Substring in Javascript using substr
const str = "Learning to code";
// start index is 1, length is 4
console.log(str.substr(1, 10));
// start index is 3, length is 2
console.log(str.substr(3, 2));
// length not given
// string extract to end of the string
console.log(str.substr(5));