Why does typeof null misbehave in switch statements?
- by user353366
It is commonly known that
typeof null
returns "object".
However, I have a piece of code that looks like this:
switch(typeof null){
case "object":
1;
default:
3;
}
This code returns 3.
Why does "object" as returned by typeof null not cause the first branch of the case statement to be executed?