New to Javascript. My function is muddled and I would like some guidance on how to execute this properly. 

This function shall display a message (from the `msg[]`) contingent on the status of an input field. Currently, there is only one condition for an input to be considered erroneous - if the input field is empty. I would like to add another condition (if an input is NaN, display appropriate message from another array called `msg2[]`) but I am lost on how to write it in. I know I could just simply utilize `HTML5`'s 'required' attribute or input `type="number"` however, I would like to hard code this function for my personal gain. 

How can I make the function choose between 2 conditions and display appropriate message from corresponding array?

```
function validateForm(someForm) {
    document.getElementById('errorMsg').innerHTML = ""; 
    var allInputs = document.getElementById("studentform").getElementsByTagName("input");
    for (var i = 0; i < allInputs.length; i++) {
        if (allInputs[i].name != "final-average-result" && allInputs[i].name != "final-letter-grade-result") {
            if (allInputs[i].value == "") {

                document.getElementById('errorMsg').innerHTML = msg[i];
                if (currentField) {
                    currentField.style.border = "2px solid #CCC";
                }
                allInputs[i].style.border = "2px dotted #F00";
                currentField = allInputs[i];
                allInputs[i].onclick = function () {
                    this.style.border = "2px dashed #CCC";
                }
                return;
            }
        }
    } // end for
} // end validateForm

var msg = ["Name should not be empty", "This field should not be empty",
"This 3rd field should not be empty", "The last field should not be empty."];
var msg2 = ["Invalid input", "error message here",......."]

```