JS String Search
Search methods answer different questions. Includes gives a boolean, while indexOf gives a position or minus one.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
const note = "Bring a small project";
console.log(note.includes("small"));
console.log(note.indexOf("project"));
What happens
The word is found and its starting position is 14.