This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.

Smartphone icons created by Freepik - Flaticon

JavaScript Strings

The indexOf() Method

indexOf() returns the position of the first occurrence of a value in a string.

Find "welcome":

let text = "Hello world, welcome to the universe.";
let result = text.indexOf("welcome");

document.getElementById("demo").innerHTML = result;