Strings In Depth15 / 18
Up next

Slice a substring

const s = "typescript";
console.log(s.slice(0, 4));
// negative indices count from the end
console.log(s.slice(-6));
console.log(s.substring(4, 6));
What you're solving

slice supports negatives; substring does not