Substring in Javascript using substring
const str = "Learning to code";
// substring between index 2 and index 5
console.log(str.substring(2, 5));
// substring between index 0 and index 4
console.log(str.substring(0, 4));
// using substring() method without endIndex
console.log(str.substring(2));
console.log(str.substring(5));