1 Ext.onReady(function(){ 2 //案例一 3 /* 4 var countries = ['Vietnam', 'Singapore', 'United States', 'Russia']; 5 Ext.Array.each(countries, function(name, index, countriesItSelf){ 6 console.log(name); 7 if(name == 'Vietnam'){ 8 return false; //停止循环 9 } 10 }); 11 */ 12 //案例二 13 var StudentsJSON = { 14 student:[{ 15 name: '张三', 16 studentid: 200801, 17 grade: 80 18 },{ 19 name: '李四', 20 studentid: 200802, 21 grade: 90 22 },{ 23 name: '王五', 24 studentid: 200803, 25 grade: 90 26 },{ 27 name: '李二麻子', 28 studentid: 200804, 29 grade: 90 30 }] 31 }; 32 33 Ext.each(StudentsJSON.student, function(student, index, self){ 34 console.log(student.name); 35 if(student.studentid == '200802'){ 36 return false; 37 } 38 }); 39 40 }); 41 </script>