创建包含问题,答案和正确答案的数组

时间:2020-01-10 14:08:14

标签: javascript xmlhttprequest

我有一个问答游戏,我想要实现的是包括一个模板表单,可以在其中添加问题和答案。

有人可以提示我如何分离文件/需要创建的文件吗?

我希望能够在浏览器中进行调整,而不是对问题进行硬编码。

// create questions
var questions = [
    new Question("What used to be the currency of Italy?",["lira","pesos","forint", "dolar"], "lira"),
    new Question("In what country was pesetas the currency??", ["Spain", "France", "Greece", "Germany"], "Spain"),
    new Question("Which country is the largest producer of olive oil?", ["Spain", "France","Greece", "Italy"], "Spain"),
    new Question("What is the world s largest office building?", ["Pentagon", "Boieng", "duPortage", "CMG"], "Pentagon"),
    new Question("What is the main component in glass?", ["Sand", "Soil", "Oil", "Wood"], "Sand")
];

0 个答案:

没有答案