Debug Increment and Decrement Operator Errors in a Buggy App - Debug Increment and Decrement Operator Errors in a Buggy App

Tell us what’s happening:

Please help I’m doing what the instructions tell me but its not working and I dont know what to do.

Your code so far

let updatedCounter = 10;
console.log(`Counter is currently ${counter}`);

let updatedCounter = ++counter;
console.log(`Counter is now ${updatedCounter}`);

let finalScore = 8;
console.log(`Score is currently ${score}`);

let finalScore = score++;
console.log(`Score is still ${finalScore}`);

let updatedCoins = 3;
console.log(`Coins is currently ${coins}`);

let updatedCoins = --coins;
console.log(`Coins is now ${updatedCoins}`);

let newHealth = 7;
console.log(`Health is currently ${health}`);

let newHealth = health--;
console.log(`Health is still ${newHealth}`);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36

Challenge Information:

Debug Increment and Decrement Operator Errors in a Buggy App - Debug Increment and Decrement Operator Errors in a Buggy App

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-debug-increment-and-decrement-operator-errors/69008059d43d6751385883c1.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @wenedog91,

I’m seeing this syntax error in the console:

SyntaxError: unknown: Identifier 'updatedCounter' has already been declared. (4:4)

  2 | console.log(`Counter is currently ${counter}`);
  3 |
> 4 | let updatedCounter = ++counter;
    |     ^
  5 | console.log(`Counter is now ${updatedCounter}`);
  6 |
  7 | let finalScore = 8;

Happy coding

please reset the challenge and try again, you can’t have the same variable declared twice