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

Tell us what’s happening:

Please help code attached… Javascript makes no sense

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function buyWeapon() {
  if (currentWeapon < weapons.length - 1) {
    if (gold >= 30) {
      gold -= 30;
      goldText.innerText = gold;
      let newWeapon = weapons[currentWeapon].name;
      text.innerText = "You now have a " + newWeapon + ".";
      text.innerText += " In your inventory you have: " + inventory; } else {
    text.innerText = "You already have the most powerful weapon!";
      text.innerText = "You do not have enough gold to buy a weapon.";

// User Editable Region

Your browser information:

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

Challenge Information:

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

Please talk to us about how you find the instructions or error message for this step confusing. Thanks

Hey jEremy, it says place the other else statement inside your if function, before the original else statement

Yes, I read the instructions. What about those instructions is confusing?

Which if statement looks like it is the “outer” one?

Hey there!
Reset your challenge and start your new else statement from line number 101.

1 Like

Thank you so much! This was very helpful!

1 Like