Types & Equality Flashcards
1
Q
What does the below code print out?
if (undefined == null) { console.log("Moo") } else { console.log("Zoo") }
A
They are actually values that can be checked for equality
Moo
2
Q
// What does the below code print out? console.log(typeof(null));
A
It should be “null” but javascript incorrectly reports the type of null as “object”.
object
3
Q
// What does the below code print out? if (undefined === null) { console.log("Moo") } else { console.log("Zoo") }
A
undefined and null are not the same types so === will return false
Zoo
4
Q
// What will the below code print out? console.log(NaN == "1");
A
NaN equal to ANYTHING is always false, even when compared to itself
False