1、break

  1. for(var i=0;i<=5;i++){
  2. if(i == 3){
  3. break
  4. }
  5. console.log(i)
  6. }

2、continue

  1. //continue跳过某个条件,继续循环
  1. for(var a=0;a<=6;a++){
  2. if(a == 3){
  3. continue;
  4. }
  5. console.log(a)
  6. }