我知道这是基本的 JavaScript:当我在 HTML 中打开它时,它会问我这个问题,但当我回答了问题后,它不会继续执行下一行代码。我现在不知道这是为什么,我非常感谢一些帮助。
<html>
<head>hi</head>
<script>if ( confirm("do you want to do the quiz") === true ) {
console.log("good")
}
else
{
console.log("ok")
}
if ( prompt("What is the capital of france?") === "Paris" ) {
Console.log("that is right")
}
else
{
consle.log("unlucky")
}
</script>
</html>
最佳答案
你拼错了console,而且JavaScript是区分大小写的语言,所以console不能写成Console
试试这个
if ( confirm("do you want to do the quiz") === true ) {
console.log("good")
}
else
{
console.log("ok")
}
if ( prompt("What is the capital of france?") === "Paris" ) {
console.log("that is right")
}
else
{
console.log("unlucky")
}
关于javascript - 在条件问题中编写 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34581446/