let str = "123456789"
str = str.slice(0, -2); // "1234567"
str = str.slice(0, -3);
var s = '/Controller/Action?id=11112&value=4444';
s = s.substring(s.lastIndexOf('/'), s.length);
let string = 'foo_bar';
string = string.slice(-4, 0); // Slice off last four characters here
console.log(string);
Run code snippetHide results