How to remove the white spaces from string, in order to get the last character?
const email = "abc@";
const emailWhiteSpace = "abc@ ";
console.log(email.trim()[email.length - 1]) //==> @
console.log(emailWhiteSpace.trim()[emailWhiteSpace.length - 1]) //==> undefinied
Any idea how to solve this issue?