JSFiddle - React, Tailwind, and code Playground

by Yevgeniy

HTML

<div id="a"></div>
<div id="b"></div>
<div id="f"></div>
<input type="text" id="e" value="2" />
<input type="button" id="b1" value="button" />

JavaScript

//checking array for containing value types
function something() {
  var e = document.getElementById("e");
  var f = document.getElementById("f");
    console.log('here');
  f.innerHTML = arr.indexOf(e.value);
}

var b1 = document.getElementById("b1");
b1.onclick = something;

var a = document.getElementById("a");
var b = document.getElementById("b");

var arr = [1,2,3,4,5,'2'];
var c = 3;
var d = '3';

a.innerHTML = arr.indexOf(c);
b.innerHTML = arr.indexOf(d);