Answer by Halcyon for Instanceof inconsistency
I've done some digging and I suppose it has to do with string interning which is a compiler optimization.Okay, ready for some gotchas? :D"abc" == "abc"; // true"abc" === "abc"; // trueI suppose this is...
View ArticleAnswer by Ry- for Instanceof inconsistency
'' isn't an instance of anything; it's a primitive type, and it works in much the same way as 5.5 or true. There's a difference between a string primitive and a String object. See:new String('')...
View ArticleAnswer by user1106925 for Instanceof inconsistency
It's because '' is primitive, not an object.Some primitives in JavaScript can have an object wrapper. These are created when you make an instance of the wrapper using the built in constructor with...
View ArticleAnswer by Jon Newmuis for Instanceof inconsistency
Note the following:"" instanceof String; // => falsenew String("") instanceof String; // => trueinstanceof requires an object, but "" is a string literal, and not a String object. Note the...
View ArticleInstanceof inconsistency
Could someone please explain the following?[] instanceof Array; // true'' instanceof String; // false
View Article
More Pages to Explore .....