Javascript Object Looping
// verify user populated input fields
for (var input in inputs) {
if (inputs.hasOwnProperty(input)) {
inputVal = inputs[input].value.trim();
if (!inputVal) {
// provide alert
setAlert(alertPossibilities.emptyInputs);
return;
}
}
}
// verify user populated input fields
Object.keys(inputs).forEach(function (k) {
// avoid inherited values
if (inputs.hasOwnProperty(k)) {
inputVal = inputs[k].value.trim();
if (!inputVal) {
// provide alert
setAlert(alertPossibilities.emptyInputs);
//return early
return;
}
}