Javascript program is not recognizing an if statement : <p>The program is running an else statement when I'm expecting an if statement to run. When the program checks the gameObject's playerSelections property against the gameObject's colorSequence property I expect the program to log 'You got it. Way to go!' if the two arrays are equivalent. Instead I keep getting the console log statement 'Better luck next time!'. Does anyone have any ideas as to why this may be happening.   `</p>

<pre><code>const $headerText = $('.fly-in-text');
setTimeout(function() {
    $headerText.removeClass('temp-hide');
}, 500);

let gameObject = {
    colorIds: ['#blue', '#red', '#green', '#yellow'],
    currentLevel: 1,
    colorSequence: [],
    playerSelections: [],
    illuminate:function(color){
        setTimeout(function(){
            $(color).css('opacity', .5);
            setTimeout(function() {
                $(color).css('opacity', 1);
            },500);
        },500);
    },
    levelSequence: function(){
        const iterationCount = this.currentLevel + 2;
        for (let i = 0; i &lt; iterationCount; i++) {
            this.colorSequence.push(this.colorIds[Math.floor(Math.random() * 4)]);
        }
        this.startGame(this.colorSequence);
    },
    startGame: function(sequence) {
        let i = 0;
        const self = this;
        var interval = setInterval(function(){
            self.illuminate(sequence[i]);
            i++;
            if (i &gt;= sequence.length){
                clearInterval(interval);
            }
        }, 1000);
    }
}

$circle.click(function() {
    clearTimeout(interval);
    $(this).toggleClass('rotate');
    gameObject.levelSequence();

    $('.colors').click(function(){
        gameObject.playerSelections.push(`#${this.id}`);
        console.log(gameObject.playerSelections);
        checkForWin();
        // for (let i = 0; i &lt; gameObject.colorSequence.length; i++) {
        //     playerSelections[i] = (`$${this.id}`);
        //     console.log(playerSelections)
        // }
    })
})
function checkForWin(){
    if (gameObject.playerSelections === gameObject.colorSequence){
        console.log('Comparing')
        if (gameObject.playerSelections === gameObject.colorSequence){
            console.log('You got it. Way to go!');
            gameObject.colorSequence = [];
            gameObject.playerSelections = [];
            gameObject.currentLevel += 1;
            $('.colors').off('click');
            return 'You got it. Way to go!';

        } else {
            gameObject.colorSequence = [];
            gameObject.playerSelections = [];
            $('.colors').off('click')
            console.log('Better luck next time!');
        }
    }
}
</code></pre>
