How can a conditional read an Object?

I’m working on a project (tic-tac-toe), and I am sending a value (player 1 or player 2) to an object, whose keys (1-9) represent the quadrants. I’ve been able to acompplish that step, now I’d like for conditionals to say: q1, q2 and q3 are player 1, thus player 1 wins. However, and I think this is due to the fact that the Object starts off with no values, the conditional is not reading it.

let player = '';
let firstChoice = ['player11'];
console.log(firstChoice);
let firstChoice1 = 'player11';
let count = 0
console.log(count);

let quadrants = {
    1: '',
    2: '',
    3: '',
    4: ''
};
console.log(quadrants);

if(quadrants[1] === 'player1') { // example of conditional
    console.log('p1');
};

let lever = 'off';
function quadrantOne() {
    let captureFirstChoice;
    captureFirstChoice = firstChoice.pop();

    console.log(firstChoice);
    if(firstChoice1 === captureFirstChoice) {
        quadrants[1] = 'player1';
        lever = 'on'; 
    };    
        if(quadrants[1] !== 'player1') {
            player = 'player2';
            if(player === 'player2' && lever === 'on') {
                quadrants[1] = 'player2';
                lever = 'off'
            }
            if(lever === 'off' && quadrants[1] !== 'player2') {
                player = 'player1';
                if(player === 'player1') {
                    quadrants[1] = 'player1';
                    lever = 'on';
                };
            };

        };
};
function quadrantTwo() {
    let captureFirstChoice;
    captureFirstChoice = firstChoice.pop();
    console.log(firstChoice);
    if(firstChoice1 === captureFirstChoice) {
        quadrants[2] = 'player1';
        lever = 'on'; 
    };    
        if(quadrants[2] !== 'player1') {
            
            player = 'player2';
            if(player === 'player2' && lever === 'on') {
                quadrants[2] = 'player2';
                lever = 'off'
            }
            if(lever === 'off' && quadrants[2] !== 'player2' ) {
                player = 'player1';
                if(player === 'player1') {
                    quadrants[2] = 'player1';
                    lever = 'on';
                };
            };

        }; 
};
function quadrantThree() {
    captureFirstChoice = firstChoice.pop();
    console.log(firstChoice);
    if(firstChoice1 === captureFirstChoice) {
        quadrants[3] = 'player1'; 
        lever = 'on';
    };    
        if(quadrants[3] !== 'player1') {
            player = 'player2';
            
            if(player === 'player2' && lever === 'on') {
                quadrants[3] = 'player2';
                lever = 'off'
            }
            if(lever === 'off' && quadrants[3] !== 'player2') {
                player = 'player1';
                if(player === 'player1') {
                    quadrants[3] = 'player1';
                    lever = 'on';
                };
            };
        }; 
};

why not add a sandbox link for this as well, that way it gets more easier for others to weigh in here and help when possible, happy coding :slight_smile:

For sure. I just pushed the code to Github: