It is well known that
typeof null
returns an "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 doesn't the "object" returned by typeof null cause the first branch of the case statement to execute?
source
share