<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Java script search in the array</title> </head> <body> <h id="display"></h> <input type="number" id="number"> <button onclick="checker()">Check in array</button> <script> var house = [1,4,3,7,6,5,6,7,2,9,20,11]; var text = ""; var number = document.getElementById("number").value; var store=0; var i; for (i = 0; i <=10; i++) { if (house[i] == number) { store = 1; break; } } if(store ==1){ text = "The number is found in the array"; } else { text = "The number is not in the Array"; } function checker(){ document.getElementById("display").innerHTML = text; } </script> </body> </html>