JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" value="a" />
<input type="text" value="b" />
JavaScript
function ShowResults(value, index, ar) {
alert(index);
}
var input = document.getElementsByTagName("input");
alert(input.length);
input = Array.prototype.slice.call(input)
input.forEach(ShowResults);