function hasPrototypeProterty(obj, name){

  return !obj.hasOwnProperty(name) && (name in obj)

}

name in obj //判断是否有这个属性,不管存在于实例还是原型中

obj.hasOwnProperty(name) //如果存在于原型中返回false

相关文章:

  • 2021-05-18
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2018-06-14
  • 2021-12-15
  • 2021-05-20
猜你喜欢
  • 2022-01-27
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案