如果没有自身改变,就会一直循环下去
n=0,只要n小于10就输出hello,和n的值,并且每次加1,直到n大于等于10,才结束
html
<!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>
var n = 0;
while (n<10){
console.log("hello",n)
n++
}
</script>
</body>
</html>