Проверьте, содержит ли строка подстроку в JavaScript

String.prototype.includes()

const str = 'Hello world';
str.includes('world'); // true
str.includes('foo'); // false

Строка.прототип.indexOf()

const str = 'Hello world';
str.indexOf('world') !== -1; // true
str.indexOf('foo') !== -1; // false

Поиск подстроки без учета регистра

const str = 'Hello world';
const token = 'WORLD';
str.toLowerCase().includes(token.toLowerCase()); // true
Текст и строки JavaScript