CHAPTER 5
document.f.elapsed.value = String(seconds); Output the time
} Close if this is the end
of the game
} Close if theres a
match
else { Else...
matched = false; Set matched to false
} Close the else
clause
firstpick = true; Reset firstpick
setTimeout(flipback,1000); Set up the pause
} Close not first pick
} Close good pick (click
on a card—for loop
exited early)
} Close the function
function flipback() { Function header—
flipback handling
after the pause
if (!matched) { If no match...
deck[firstcard].draw(); ...Draw the card back
deck[secondcard].draw(); ...Draw the card back
} ...Close the clause
else { Else need to remove
cards
ctx.fillStyle = tablecolor; Set to the table/board
color