Conceited
Conceited

Reputation: 1

How do I solve these debug errors in my code

I am coding a project in the coding IDE called code.org and I have come across this error in this patch of code that's making my whole project stop working after a certain point. The following code is the erroring code :

  // Add event listeners for button clicks
  for (var i = 0; i < shuffledButtons.length; i++) {
    var buttonId = shuffledButtons[i];
    onEvent(buttonId, "click", function() {
      var buttonText = getText(buttonId).toLowerCase();
      if (buttonText === correctAnswer.toLowerCase()) {
        score++;
      }
      console.log("Score: " + score);
      setScreen(screen); // Move to the next question screen
    });
  }
}

Any help and request are appreciated!

Upvotes: -3

Views: 23

Answers (0)

Related Questions