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

let a = document.getElementsByClassName("demo") HTMLCollection.prototype.aaa=function(){ console.log("html 对象的原型是 HTMLCollection") } console.log(a) // 对象的原型在里面又 console.log(typeof a) // object a.aaa()
相关文章
相关标签/搜索