[英]Why does this happen when I run the code?
When I run this, my computer start lagging and browser shows(not responding)当我运行它时,我的计算机开始滞后并且浏览器显示(无响应)
let number8 = 0.1;
while (number8 <= 11.5) {
console.log(number8);
number = number8 + 2;
}
Not entirely sure if this will solve the issue but your while
loop never finishes, that may be causing the lag.不完全确定这是否会解决问题,但您的
while
循环永远不会完成,这可能会导致滞后。
Maybe you misspelled the number8
variable and put just number
in the line 4:也许你拼错了
number8
变量,只在第 4 行输入了number
:
number = number8 + 2;
This one should work这个应该工作
let number8 = 0.1;
while (number8 <= 11.5) {
console.log(number8);
number8 = number8 + 2;
}
Now the while
loop will end when number8 <= 11.5
现在
while
循环将在number8 <= 11.5
时结束
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.