DOM节点借用Array原型方法
作者:互联网
<button class="red">red</button>
<button></button>
let arr=[1,3,4,34]; let res= arr.filter(item=>{ return item>30; }); console.log(res); let btns= document.querySelectorAll("button"); btns=Array.prototype.filter.call(btns,item=>{ // btns=[].filter.call(btns,item=>{ return item.hasAttribute("class"); }); console.log(btns);
标签:arr,console,DOM,filter,item,let,Array,节点,btns 来源: https://www.cnblogs.com/yyy1234/p/15852982.html