-
Is there a difference between
typeof value === "undefined"andvalue === undefined? -
Why did JavaScript need
Array.isArray()in ECMAScript 5? Can’t I just callvalue instanceof Arrayto determine whether an given variable is an array?
Is there a difference between typeof value === undefined and value === undefined ?
Share
There are also issues with
undefined = truebeing valid. But you don’t really care about that. No-one is stupid enough to alterundefinedglobally these days.I also know of bugs with
instanceofbeing broken. I can’t give you the exact reason whyArray.isArrayis better though.You will find criticism on
instanceofin the JavaScript GardenIf you read this Article It mentions how
instanceofdoes not work across seperate frames / windows / iframes.Because instanceof checks againts
Arrayand each window has it’s ownwindow.Array.