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));
slice supports negatives; substring does not