js 获取的 html 对象,给其原型对象添加方法

let a = document.getElementsByClassName("demo")

HTMLCollection.prototype.aaa=function(){

console.log("html 对象的原型是 HTMLCollection")

}

console.log(a) // 对象的原型在里面又

js 获取的 html 对象,给其原型对象添加方法

console.log(typeof a) // object

a.aaa() // "html 对象的原型是 HTMLCollection"

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2021-12-27
  • 2021-12-23
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案