The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Store JSON data in a variable Reply To: Store JSON data in a variable


@traq – I’m building the quiz application from “How to learn JS properly” guide and one of the tasks is to store the quiz questions(an array of objects) in an external JSON file but doesn’t explain why I should do the task.

My quiz questions:

var questions = [{question: 1}, {question: 2}, {question: 3}];

So why I should separate them from the other code?