JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="number1" value="1"/>
<input type="text" id="number1" value="2"/>
JavaScript
var arrays = {
'1' : [],
'2' : []
};
function x() {
for(var i = 1; i<=2; i++) {
var number = document.getElementById("number" + [i]);
arrays[i].push(number.value);
}
alert(arrays);
}
x();