摘要: $(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 阅读全文
posted @ 2012-12-27 17:50 不要说话,用心听 阅读(411) 评论(0) 推荐(0) 编辑