string javascript dapatkan dua karakter terakhir
var member = "my name is Mate";
var last2 = member.slice(-2);
alert(last2); // "te"
Frightened Flatworm
var member = "my name is Mate";
var last2 = member.slice(-2);
alert(last2); // "te"
var hello = "Hello World";
var lastCharOfHello=hello.slice(-1);//d
var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell
const id = "ctl03_Tabs1";
console.log(id.slice(id.length - 5)); //Outputs: Tabs1
console.log(id.slice(id.length - 1)); //Outputs: 1
'abc'.slice(-1); // c
// Get last n characters from string
var name = 'Shareek';
var new_str = name.substr(-5); // new_str = 'areek'