Learn Basic JavaScript by Building a Role Playing Game - Step 101

I am stuck on Javascript Step 101.
In the code below I have to put “goldText.innerText = gold” inside the if statement. I tried this : if (inventory.length > 1, gold += 15, goldText.innerText=gold) {
}
It is not taking this as inside if statement.

If it not inside then where do I put it?

function sellWeapon() {
if (inventory.length > 1, gold += 15) {
goldText.innerText=gold

}
}

Welcome to the forum @Webdevsonu

Remove this code from the if condition, and place it on a new line after the curly bracket.

Make sure to remove the comma from the condition statement.

Happy coding

1 Like

Thank you it helped.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.