"foo" instanceof String //=> false
"foo" instanceof Object //=> false
true instanceof Boolean //=> false
true instanceof Object //=> false
false instanceof Boolean //=> false
false instanceof Object //=> false
// the tests against Object really don't make sense
Array literals and Object literals match...(数组文字和对象文字匹配...)
[0,1] instanceof Array //=> true
{0:1} instanceof Object //=> true
Why don't all of them?(为什么不是所有人?)
Or, why don't they all not ?(或者,为什么不是所有人都不呢?) And, what are they an instance of, then?(而且,它们是什么实例呢?)
It's the same in FF3, IE7, Opera, and Chrome.(在FF3,IE7,Opera和Chrome中相同。)
So, at least it's consistent.(因此,至少是一致的。)
Missed a few.(错过了几个。)
12.21 instanceof Number //=> false
/foo/ instanceof RegExp //=> true
ask by Jonathan Lonowski translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…