xxxxxxxxxx
let str = 'John Wick'
let firstChar = str.charAt(0)
console.log(firstChar); // "J"
xxxxxxxxxx
var str = "Hello world That is reallly neat!";
var res = str.substring(0, 5);//get first 5 chars
xxxxxxxxxx
let sentence = "The big brown fox"
let word = sentence.split(" ")[0]
console.log(word) // The
xxxxxxxxxx
const string = 'Hello';
const firstCharacter = string.charAt(0);
console.log(firstCharacter);
xxxxxxxxxx
const str = "Hello world";
const firstChar = str.charAt(0); // Retrieves the first character of the string
console.log(firstChar); // Outputs 'H'