Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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));
Source by www.tutorialstonight.com #
 
PREVIOUS NEXT
Tagged: #Substring #Javascript #substr
ADD COMMENT
Topic
Name
4+7 =