Question: How do I fix my search function so that if a user types in a cereal brand and searches it, the cereal's name and calorie

 How do I fix my search function so that if a

How do I fix my search function so that if a user types in a cereal brand and searches it, the cereal's name and calorie amount is displayed by searching through the length of the list? Right now I am getting an error in java that list.includes is not a function.

11 TU 11 81 var random Index randomNumber(0, nameList.length); 82 appendItem(tempList, nameList [randomIndex] + " + calorieList [randor 83 random Index = randomNumber(0, nameList.length) ; 84 appendItem(tempList, nameList [random Index] + + calorieList [randor 85 randomIndex = randomNumber(0, nameList.length); 86 appendItem(tempList, nameList [randomIndex] + + calorieList [randor 87 setText("randomOutput", tempList.join (" ")); 88 }); 89 90 - onEvent ("searchButton2", "click", function() { 91 tempList= []; 92 var tempKeywords= getText("searchInput"); 93 if (tempKeywords != ""){ 94 search (tempKeywords, calorieList); 95 search (tempKeywords, nameList); 96 setText("searchOutput", tempList.join(" ")); 97 } else { 98 setText ("searchOutput", "Please type something into the search bar."); 99 } 100 }); 101 - function search (keywords, list) { 102 - for (var i 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!