js基础 Array.from

var div = document.querySelectorAll("div");
console.log(Array.from(div));

Array.from(div,function(item){
  item.style.backgroundColor="red";
  return item;
});

 

posted @ 2021-02-26 20:46  AngDH  阅读(62)  评论(0编辑  收藏  举报