Here when there is a requirement for entering a table input of two or more fields the value of the table should be should stored as an array of objects with key and value pair format.
This code stores the values in an array as objects from each row.
Example:
var inputs = document.getElementsByClassName("sku-input");
for (var i = 0; i < inputs.length; i += 2) {
inputData.push({['SKU']: inputs[i].value, ['QTY']: inputs[i+1].value});
}
inputs variable selects the input fields with a common class
i +=2 determines the number of input fields if there are more in numbers assume n the value will be i+=n
Hence we are pushing the data to the array in form of a GP.