Dapatkan tiga karakter terakhir dari string javascript
var member = "my name is Afia";
var last3 = member.slice(-3);
alert(last3); // "fia"
Fine Frog
var member = "my name is Afia";
var last3 = member.slice(-3);
alert(last3); // "fia"
var member = "my name is Mate";
var last2 = member.slice(-2);
alert(last2); // "te"
'abc'.slice(-1); // c
var hello = "Hello World";
var last5 = hello.slice(-5);
alert(last5); // "World"