Hi! At the end I passed the challenge with a different, shorter code, but I can’t understand the reason why with the following code the last test case with NaN value (truthCheck([{"single": "double"}, {"single": NaN}], "single")
) returns true… What am I missing?
###spoiler alert!
function truthCheck(collection, pre) {
// Is everyone being true?
for(var i in collection) {
switch(collection[i][pre]){
case null:
case undefined:
case 0:
case NaN:
case '':
case "":
return false;
}
}
return true;
}