questionmodel.js
// Experimental Verb Generator
function randomSample(arr) {
return arr[Math.floor(Math.random()*arr.length)];
}
function randKey(dict) {
return randomSample(Objects.keys(dict));
}
var objMap = {
"the ball":[
"bounces",
"moves",
"jumps",
"rolls"
]
};
function question(){
return {
"Q":"the ball ___.",
"A":objMap["the ball"],
check:function(ans){
for(var i=0;i<objMap["the ball"].length;i++)
{
if(objMap["the ball"][i] === ans) return true;
}
return false;
}
};
}