how to search for a letter in a string in javascript code example Example: javascript select letter in string const str = 'Hello'; str.substring(0, 2); // => 'Hel'