<html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body> <script> for(var i=0;i<5;i++) { if(i==2) { break; //整个循环中断了,只循环到i=2结束 //continue; //本次循环中断了,跳过i=2继续循环 } alert(i); } </script> </body> </html>
查看原文