javascript get specific character from string code example

Example 1: how to get the first character of a string in javascript

let str = 'John Wick'
let firstChar = str.charAt(0) 
console.log(firstChar); // "J"

Example 2: How find a specific character in js

var word = "This is how you locate a word in a string";
var n = word.includes("word");

Example 3: how to identify specific letter from a string in javascript

var str = "Hello world, welcome to the universe.";
var n = str.includes("world", 12);