JSFiddle - React, Tailwind, and code Playground
JavaScript
function averageCalculator (rowInputs) {
for(var i=0; i<rowInputs.length; i++){
// ...we get its value (parsed to an integer)
value = parseInt(rowInputs[i].value);
// ...and if that value isn't undefined or NaN, add
// it to the sum, and increment the counter
if (value){
sum += value;
count++;
}
}
}