Answers for "Substring in Javascript using substr"

0

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));
Posted by: Guest on December-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language