How to get first character of String in Javascript

Use s.charAt(0)

Example:

first_char_js_example.js
const s = "banana";
const firstChar = s.charAt(0); // == 'b'
// This will print 'b'
console.log(firstChar);

Check out similar posts by category: Javascript