JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick="myFunction()">Try it</button>
JavaScript
function myFunction() {
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var a = fruits.indexOf("kiwi");
switch (fruit_type) {
case fruits.indexOf(fruit_type) > -1:
alert('fruit found');
break;
default:
alert('no fruit for you');
}
}