javascript你可能不知道的5

javascript中,break, continue可以有一个标签,来方便的跳到几层之外。
outer:
for(i=0;i<5;i++){
for(j=0;j<5;j++){
if(j==2)
break outer;//
document.write(i+’, ‘+j+’; ‘);
}
}
比较一下不加outer的情况。也试验一下continue。很有用吧

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.