You have a simple syntax error.
if (cardsInPlay.length
cardsInPlay[0]
By placing the second condition inside the bracket {, you made it ineffective. Try the following:
if (cardsInPly.length === 2 && cardsInPlay[0] === cardsInPlay[1]) {
( ). , .
cardsInPlay[0] === cardsInPlay[1];, , false;. , .