QUIZ
Code Explanation
slots[i] = -100; Used values will be 0 to 19
} Close of for loop
for(i=0;i<nq;i++) { Start of for loop to choose nq country/capital pairs
Recall our nq is set to 4, 4 country-capital pairs
do {c = Math.floor(Math.
random()*facts.length);}
Start of do/while loop. What is in the brackets is done at
least once. The variable c is set to a random value 0 to 1
less than the length of the array.
while (facts[c][2]==true) Do this again if this inner array (country/capital pair) has
been chosen
facts[c][2]=true; Outside of loop, now set this country/capital pair array as
being used
uniqueid = "c"+String(c); Construct the id for the country block
d =
document.createElement
('country');
Create an html element of type country
d.innerHTML = ( Set its innerHTML to be
"<div class='thing'
id='"+uniqueid+"'>placeholder