const str = "Learning to code"; // 3 ways to get substring in javascript // 1. substring() method // 2. slice() method // 3. substr() method console.log(str.substring(0, 5)); console.log(str.substring(0, 5)); console.log(str.substr(2, 5));