gpt4 book ai didi

javascript - 如何正确使用var

转载 作者:行者123 更新时间:2023-11-30 08:52:33 25 4
gpt4 key购买 nike

我刚开始在 codecademy 上学习 Javascript,不知道这段代码有什么问题。

var feedback = prompt("Rate this game out of 10");
if(feedback > 8) {
console.log("This is just the beginning of my game empire. Stay tuned for more!");
}
else {
console.log("I slaved away at this game and you gave me that score?! The nerve! Just you wait!")
};

它说变量有问题。这可能是一个太简单的问题,但我不知道如何解决。

最佳答案

在 javascript 中,不允许在字符串中使用硬中断。

这一行:

console.log("I slaved away at this game and you gave me that score?! The nerve! Just you          
wait!")};

应该是:

console.log("I slaved away at this game and you gave me that score?! The nerve! Just you wait!")};

关于javascript - 如何正确使用var,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16537328/

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