JSFiddle - React, Tailwind, and code Playground

by Ron Eaglin

HTML

<input type="button" value="Go" onclick="main()"/>
<div id="output">

</div>

JavaScript

function main(){
// Create a list of product numbers.
var prod_nums = ["A", "B", "C"];

// Get a product number to search for.
var search = prompt("Enter a product number: ");

// Determine whether the product number is in the list.
if (search in prod_nums){
document.getElementById("output").innerHTML = search + " was found in the list.";
}else{
document.getElementById("output").innerHTML = search + " was not found in the list.";
}
}