I dont understand why when the number is NaN the result of my code isnt returning false?
link to challenge:
function truthCheck(collection, pre) {
let newArr = []
for (let i = 0; i<collection.length; i++){
newArr.push(collection[i][pre])
}console.log(newArr[0])
console.log(Array.isArray(newArr[0]))
for (let x=0; x<newArr.length; x++){
if (newArr[x] == false || newArr[x] == undefined || newArr[x] == NaN){
return false;
} if (Array.isArray(newArr[0]) == true){
return true;
}
}return true;
}
truthCheck ([{name: "Quincy", username: "QuincyLarson"}, {name: "Naomi", username: "nhcarrigan"}, {name: "Camperbot"}], "username") ;