Substring with slice
suggest changeUse .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"
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents