Jak zdobyć pierwszy postać łańcucha w JavaScript
let str = 'John Wick'
let firstChar = str.charAt(0)
console.log(firstChar); // "J"
Busy Buffalo
let str = 'John Wick'
let firstChar = str.charAt(0)
console.log(firstChar); // "J"
var member = "my name is Afia";
var last3 = member.slice(-3);
alert(last3); // "fia"
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
str.charAt(str.length-1)