let str = "123456789" str = str.slice(0, -2); // "1234567"
str = str.slice(0, -3);
let string = 'foo_bar'; string = string.slice(-4, 0); // Slice off last four characters here console.log(string); Run code snippetHide results