JavaScript mendapatkan karakter terakhir dalam string
var hello = "Hello World";
var lastCharOfHello=hello.slice(-1);//d
Grepper
var hello = "Hello World";
var lastCharOfHello=hello.slice(-1);//d
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
'abc'.slice(-1); // c
let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);
// Get last n characters from string
var name = 'Shareek';
var new_str = name.substr(-5); // new_str = 'areek'