js ตรวจสอบว่าข้อความเกี่ยวกัจากตารางคู่ลำดับ
wordsArray = ['hello', 'to', 'nice', 'day']
yourString = 'Hello. Today is a nice day'.toLowerCase()
result = wordsArray.every(w => yourString.includes(w))
console.log('result:', result)
ถ้าอาเรย์รวมถึงการข้อความ
function droids(arr) {
result = "These are not the droids you're looking for."
for (str of arr) {
if (str == 'Droids')
result = "Found Droids!"
}
return result;
}