gpt4 book ai didi

JavaScript 错误 : "There is an unexpected token in while loop" when using console. 日志

转载 作者:行者123 更新时间:2023-11-28 12:13:27 27 4
gpt4 key购买 nike

我不知道为什么我在 while 循环中收到意外的 token 。

var num = 1
while(num <= 20){
if(num % 4 === 0)
console.log(num);
}
num++;
}

我希望 while 循环成功运行并输出条件。

最佳答案

var num = 1;
while (num <= 20) {
if (num % 4 === 0)
console.log(num);

num++;
}

最后有一个额外的右括号:(})

关于JavaScript 错误 : "There is an unexpected token in while loop" when using console. 日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55551408/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com