JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<input type="number" class="form-control" id=0 onkeyup="a(this)" mix="0" max="4">
    <input type="number" class="form-control" id=1 onkeyup="a(this)" mix="0" max="4">
</html>

<script>
function a(c){

        var dps = [];
        var id = c.id;
        var valueStr = c.value;
        var value = parseInt(valueStr)
        if (0 <= value <= 4) {
            dps[id]=value;
            console.log("id: ",id);
            console.log("value: ", value);
            console.log("length: ",dps.length);
            console.log(typeof value);
		}
}
</script>