I'm trying to check to see if an input is NaN, basically I want to alert 0 if nums doesn't have anything in it, or if that something is a 0. Any ideas on how to go about this?
var sumofnums = 0,
nums = document.getElementById("nums").value.split(",");
function add(){
for (i = 0; i < nums.length; i++) {
sumofnums += parseInt(nums[i]);
};
document.getElementById("sum").innerHTML = sumofnums;
};
if (nums === ''){
alert('0');
}