Я пишу эту функцию, но она работала только с одной строкой,
contains(input,words) {
let input1 = input.split(' ');
for ( var i = 0; i < input1.length; i++ ) {
if (input1[i] === words) {
return true;
}
else {
return false;
}
}
}
let contains = Str.prototype.contains('hello me want coffee','hello');
вернет true
как заставить ее работать с несколькими словами
let contains = Str.prototype.contains('hello me want coffe',['hello','want']);