Basic javascript step 81

Im trying to include the if statement condition to this code:

function buyHealth() {
  if (gold >= 10) {
  health += 10;
  goldText.innerText = gold;
  healthText.innerText = health;
} else {
  console.log("not enough gold");
}
}

but im getting this error: All of your buyHealth code should be inside the if statement. . What is wrong with my code. kindly assist.

can you give the link to the step please?

Hi @magdalinemumbi573

Here is the original code.

The instructions did not ask you to include an else statement, or the console.log in the body of the else statement.

So please remove all of that code.

Then add this line of code in the first line in the body of the if statement.
It seems to have gone missing.

Happy coding

Thanks a lot . it passed.