Substring with slice

suggest change

Use .slice() to extract substrings given two indices:

var s = "0123456789abcdefg";
s.slice(0, 5);  // "01234"
s.slice(5, 6);  // "5"

Given one index, it will take from that index to the end of the string:

s.slice(10);    // "abcdefg"

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents