break循环
首先i=0,判断i是否<=5,满足条件,判断i是否等于3,i不等于3,输出i=0,i的值加1,判断i是否<=5,判断i是否等于3,i不等于3,输出i=1,i的值加1,判断i是否<=5,判断i是否等于3,i不等于3,输出i=2,i的值加1,判断i是否<=5,判断i是否等于3,i等于3,跳出循环,结束
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
for(var i=0;i<=5;i++){
if(i===3){
break
}
console.log(i)
}
</script>
</body>
</html>
continue
i=0,判断i<=5,判断i是否等于3,不等于,输出i=0,i=i+1,
判断i<=5,判断i是否等于3,不等于,输出i=1,i=i+1,
判断i<=5,判断i是否等于3,不等于,输出i=2,i=i+1,
判断i<=5,判断i是否等于3,i等于3,跳过,之后的代码都不执行,i=i+1,
判断i<=5,判断i是否等于3,i不等于3,输出i=4,i=i+1,
判断i<=5,i等于5,结束
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
for(var i=0;i<=5;i++){
if(i===3){
continue
}
console.log(i)
}
</script>
</body>
</html>