Created
March 24, 2018 17:50
-
-
Save ldco2016/54289bf684e1d57b627ad695f07f1331 to your computer and use it in GitHub Desktop.
example of my version of the beginning stages of the JavaScript for a quiz app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var output = document.getElementById('output'); | |
var myData = '[{"question":"What color is an apple?","answers":["Blue","Red","Purple"],"correct":1},{"question":"What color is grass?","answers":["Green","Red","Purple"],"correct":0}]' | |
var myObj = JSON.parse(myData); | |
for (var i in myObj) { | |
output.innerHTML += myObj[i].question + '? <br>'; | |
} | |
output.innerHTML = myObj[0].question; | |
console.log(myObj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment