1 instance of Number // false

  • 1 instanceof Number   // false
  • new Number(1) instanceof Number // true

 

Strings and numbers are primitive values, not objects and therefore don't have a [[Prototype]], so it'll only work if you wrap them in regular objects (called 'boxing' in Java).

 

new (1) instanceof Number // true

posted @ 2020-06-08 17:47  hh9515  阅读(502)  评论(0编辑  收藏  举报