3.数组遍历

Javascript中提供了多种基本的数组遍历方法

some : stop looping the first time the iterator returns true or something truthy


demo

every: stops looping the first time the iterator returns false or something falsey


demo

filter:creates a new array including elements where the filter function returns true and omiting the ones where it returns false


demo

map:creates a new array from the values returned by the iterator function


demo

forEach:


demo

for:


demo

Jquery中提供了多种遍历方法

$each : jquery object , array , dom array


demo

$map


demo

$domEach


demo

JSRUN notes