Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
Why wont the value change in the array?

why is it console.logging the array with all zeroes??

im clearly changing value but its still console.logging with just zeroes

let a = 0,
    b = 0,
    c = 0,
    d = 0,
    e = 0
    f = 0,
    g = 0,
    h = 0,
    i = 0;

const test = document.querySelector(".test");
test.addEventListener("click", () => {
    a = 1;
    b = 1;
    c = 1;
    gameBoard.winConditions;
    console.log(gameBoard.winConditions)
})

const gameBoard = {
    winConditions: [[a, b, c], [a, d, g], [a, e, i], [b ,e, h], [c, e, g], 
                   [c, f, i], [d, e, f], [g, h, i]]
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

gameBoard.winConditions; this line does nothing. When updating the a,b,c... variables, the winConditions stay the same. I would recommend to write a function to re-evaluate the value of winConditions:

let a = 0,
    b = 0,
    c = 0,
    d = 0,
    e = 0
    f = 0,
    g = 0,
    h = 0,
    i = 0;

const test = document.querySelector(".test");
test.addEventListener("click", () => {
    a = 1;
    b = 1;
    c = 1;
    applyWinConditions();
    console.log(gameBoard.winConditions)
})

const gameBoard = {};

applyWinConditions(); // set the win conditions initially

function applyWinConditions() {
  gameBoard.winConditions = [[a, b, c], [a, d, g], [a, e, i], [b ,e, h], [c, e, g], [c, f, i], [d, e, f], [g, h, i]];
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!