Here's my problem:
let a = "abcd2";
a[a.length - 1] = "0";
console.log(a);
the output is still "abcd2", but I want it to be "abcd0", this code isn't working, what should i do?
I also tried to use slice(-1)
to get last character of string, but it shows error: 'Uncaught ReferenceError: Invalid left-hand side in assignment'