js convert nan to 0 code example
Example 1: how to replace nan with a value in js
if (isNaN(a)) a = 0;
Example 2: how to replace nan with a value in js
function getNum(val) {
val = +val || 0
return val;
}
if (isNaN(a)) a = 0;
function getNum(val) {
val = +val || 0
return val;
}