📜  js foreach 类 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:08.587000             🧑  作者: Mango

代码示例4
const elements = document.querySelectorAll('.testimonial');
Array.from(elements).forEach((element, index) => {
  // conditional logic here.. access element
});

// -------------------------------------- OR

var testimonials = document.querySelectorAll('.testimonial');
Array.prototype.forEach.call(testimonials, function(element, index) {
  // conditional logic here.. access element
});