Zdobądź ostatnie trzy znaki JavaScript String
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"
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