JSFiddle - React, Tailwind, and code Playground
HTML
<div id="question"></div>
<ul id="choices"></ul>
JavaScript
var data = {
"text": "What does the author least like about Eclipse?",
"choices": [
"The plugin architecture.",
"FindBugs.",
"Refactoring.",
"The Run As menu."],
"answer": 3
};
$.each(data, function (key, value) {
if (key === 'text') {
$('#question').append(value);
}
if (key === 'choices') {
for (var i = 0; i < value.length; i++) {
var option = ('<li>' + value[i] + '</li>');
$('#choices').append(option);
}
}
});