1. 如果不想输出第一项 (使用retrun true)进入 下一遍历
<!DOCTYPE html>
<html>
<head>
<script src=https://www.jb51.net/”http:/code.jquery.com/jquery-latest.js”></script>
</head>
<body>
<script>
var myArray=["skipThis", "dothis", "andThis"];
$.each(myArray, function(index, value) {
if (index == 0) {
return true; // equivalent to ‘continue' with a normal for loop
}
// else do stuff…
alert (index + “: “+ value);
});
</script>
</body>
</html>
您可能感兴趣的文章: