Matching game - change bg color when condition is met

Matching game - change bg color when condition is met

The problem follows the code: Matching Game

Click two different cards to see if they match!

  • salmon
  • swordfish
  • swordfish
  • shrimp
  • lobster
  • scallops
  • lobster
  • salmon
  • tuna
  • scallops
  • tuna
  • shrimp
I'm writing a basic memory game where you flip 2 cards and if they don't match, they flip back over, but if they do match their background color changes. All of the flipping is done on click; it adds a class of flipped. Right now nothing happens when a match is made; the cards just stay there keeping the flipped class. How can I make it so the bg color changes on a match? Also, I want a button that can reset the game back to all blank cards at any time.How would I do this?