JavaScript obtenga el último carácter de cadena
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
Grepper
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
'abc'.slice(-2);
str.charAt(str.length-1)
//Gettimg the last character of an unknown string;
//using function Expression;
const gettingLastChar = function(userInput){
return userInput.substring(userInput.length -1);
//for Debugging;
let letsDebug = `${userInput.substring(userInput.length -1)}`;
console.log(letsDebug);
}
how to get the last character of a string