let str = 'nilpointer';
let keyword1 = 'poi';
if (str.includes(keyword1)) {
console.log('keyword1 is in the string')
} else {
console.log('keyword1 is not in the string')
}
Output
keyword1 is in the string
let str = 'nilpointer';
let keyword1 = 'poi';
if (str.includes(keyword1)) {
console.log('keyword1 is in the string')
} else {
console.log('keyword1 is not in the string')
}
keyword1 is in the string