I have following code snippets.
var caseObj = function () {
}
switch (typeof caseObj) {
case "function":
console.log("it is function");
case "object":
console.log("It is object now");
}
Its output is
it is function.
It is object now.
But typeof caseObj
gives output function
but it still evalutes
case "object" case also.
How it is possible? Am I doing wrong anythig?
EDIT :
typeof caseObj
is giving function
,So it executing that case but it also
executing object
case.Why this strange behavior?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…