/* A instanceOf B
  判断B的prototype是否出某个实例对象的原型链上
*/
function Person(){}
let p1 = new Person();
console.log(p1.__proto__ === Person.prototype);
console.log([] instanceof Array);
console.log(Function instanceof Function);
console.log(Object instanceof Function);
console.log(Date instanceof Function);
console.log(p1 instanceof Object);
console.log(Object.prototype.toString.call(""));
console.log(Object.prototype.toString.call(1));
console.log(Object.prototype.toString.call(null));
console.log(Object.prototype.toString.call(false));
console.log(Object.prototype.toString.call([]));
console.log(Object.prototype.toString.call({}));
posted on 2022-06-16 21:15  文种玉  阅读(94)  评论(0编辑  收藏  举报