Use s.charAt(0)
Example:
const s = "banana"; const firstChar = s.charAt(0); // == 'b' // This will print 'b' console.log(firstChar);
Use s.charAt(0)
const s = "banana"; const firstChar = s.charAt(0); // == 'b' // This will print 'b' console.log(firstChar);
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow