javascript - 来自 json 的测验脚本
问题描述
我正在制作一个测验脚本来学习 javascript。我有一个包含测验问题和答案的 json 文件
例子:
"quiz": [
{
id:"0";
question: "Who is the strongest?",
answers: [
{"name":"btn1","next_question":"1"},
{"name":"btn2","next_question":"2"},]
},
},
{
id:"1";
question: "What is the best site ever created?",
answers: [{
{"name":"btn1","next_question":"0"},
{"name":"btn2","next_question":"2"},]
},
},
{
id:"2";
question: "Where is Waldo really?",
answers: {
{"name":"btn1","next_question":"1"},
{"name":"btn2","next_question":"2"},
},
}];}
因此,我需要始终从 id (0) 的问题开始进行测验。next_question 字段显示下一个问题将是什么。我怎样才能使这成为可能?谁能帮我解决这个问题?
解决方案
推荐阅读
- c# - 如何从 UTF8 编码的 sql server 获取数据?
- mongodb - 从 4.0 升级到 4.2 后无法访问 MongoDB 数据
- r - 如何在R中长时间使清晰的图形更平滑
- java - 将一些值从一个 ArrayList 复制到另一个 kotlin
- r - 使用索引在数据帧上创建 t 检验循环
- mysql - 即使有索引,我的查询也很慢
- python - 如何用相似的词得到正确的 if 语句?
- c - BFS 上的无限循环
- nativescript - 更新 nativescript 文件夹和文件后未在我的 android 手机中创建
- sql-server - 当另一个索引聚集时,我可以使主键不聚集吗?