Remova o sufixo String js
let text = 'ABCD';
// replace the last two characters with empty string
let result1 = text.replace(/.{0,2}$/, '');
// remove the last two characters
let result2 = text.slice(0, -2);
// remove the last two characters
let result3 = text.substring(0, text.length - 2);
console.log(result1); // AB
console.log(result2); // AB
console.log(result3); // AB
Jumping Boy