JS String Slice Last N Elements

const str = 'ECMAScript 2015';
const n = 4;
console.log(str.slice(-n));
// Output: 2015
GutoTrosla