摘要:
$(function(){varsss=[3,2,1,4,5];$.each(sss,function(i,o){if(o>1){document.writeln(o);}else{returnfalse;//相当于breakreturn;//相当于continue}})})ECMAScript5中添加的forEach如果要提前终止需要用包括在try catch中varsss=[3,2,1,4,5];try{sss.forEach(function(o){if(o>1){document.writeln(o);}else{throw"asdasd";}})}ca 阅读全文