Check whether a string contains a smaller string.

Text Search

text_search.js
const term = "cat";
const line = "cat dog cat";
const found = line.includes(term);
const position = line.indexOf(term);

console.log("term=" + term);
console.log("found=" + found);
console.log("position=" + position);
text-search `includes` answers a true/false question. `indexOf` returns the first position or `-1` when the text is missing.