javascript - 我的控制台显示 Uncaught SyntaxError: Unexpected identifier
问题描述
它显示在第四行
var questions =[{
question: "Who was the King after God's heart?",
Choices: ["Adam", "Solomon", "Daniel", "David"]
correctAnswer: 3
}]
解决方案
你只是忘了一个逗号
var questions =[{ question: "Who was the King after God's heart?", Choices: ["Adam", "Solomon", "Daniel", "David"], correctAnswer: 3 }]
var questions =[
{
question: "Who was the King after God's heart?",
Choices: ["Adam", "Solomon", "Daniel", "David"], // this is the comma you forgot
correctAnswer: 3
}
]
console.log(questions)
推荐阅读
- c++ - cin.fail() 和 !(cin>>var) 在输入多个整数然后是字符串或字符时失败
- c# - 将十六进制转换为 unicode
- javascript - 在 ReactJs 中制作计时器/倒计时代码时遇到问题
- node.js - 在nodejs中以windows-1251编码格式下载文件
- javascript - 如何在反应中将我的导入缩短为“@dir/subdir/file”中的 import xxx
- docker - Kubernetes集群初始化问题
- python - += 不支持的操作数类型:“方法”和“整数”
- git - git push 成功并且能够看到比较和拉入 git hub 但无法接受或合并它
- javascript - 如何为整个文件制作 const?
- python - 优化 pandas 数据框中子集的汇总和其他向量操作