js/app.js
/**
 * @description Keeps track of any two open cards and toggles the cards based on if two identical cards are clicked or not
 * Calls updateRating method to update the star ratings
 */
@description Keeps track of any two open cards and toggles the cards based on if two identical cards are clicked or not
Calls updateRating method to update the star ratings
@description Keeps track of any two open cards and toggles the cards based on if two identical cards are clicked or not Calls updateRating method to update the star ratings
function findMatchCards() {
    const openCards = document.querySelectorAll('.open');
    if (openCards.length === 2) {
        if (openCards[0].firstElementChild.className === openCards[1].firstElementChild.className) {
            updateClass(openCards[0], 'card match', false);
            updateClass(openCards[1], 'card match', false);
        } else {
            updateClass(openCards[0], 'no-match', true);
            updateClass(openCards[1], 'no-match', true);
            setTimeout(function () {
                updateClass(openCards[0], 'card', false);
                updateClass(openCards[1], 'card', false);
            }, 1000)
        }
        updateRating();
    }
}
function findMatchCards ( ) { const openCards = document . querySelectorAll ( '.open' ) ; if ( openCards . length === 2 ) { if ( openCards [ 0 ] . firstElementChild . className === openCards [ 1 ] . firstElementChild . className ) { updateClass ( openCards [ 0 ] , 'card match' , false ) ; updateClass ( openCards [ 1 ] , 'card match' , false ) ; } else { updateClass ( openCards [ 0 ] , 'no-match' , true ) ; updateClass ( openCards [ 1 ] , 'no-match' , true ) ; setTimeout ( function ( ) { updateClass ( openCards [ 0 ] , 'card' , false ) ; updateClass ( openCards [ 1 ] , 'card' , false ) ; } , 1000 ) } updateRating ( ) ; } }
@description Keeps track of any two open cards and toggles the cards based on if two identical cards are clicked or not
 Calls updateRating method to update the star ratings
@description Keeps track of any two open cards and toggles the cards based on if two identical cards are clicked or not Calls updateRating method to update the star ratings