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

Tell us what’s happening:

Describe your issue in detail here.

These are the instructions… Now you need to modify your display text. Change the innerText property of the text to be You enter the store.

I have been trying to get the solution to pass. Help pls

/* file: script.js */
let xp = 0;
let health = 100;
let gold = 50;
let currentWeapon = 0;
let fighting;
let monsterHealth;
let inventory = ["stick"];

const button1 = document.querySelector('#button1');
const button2 = document.querySelector("#button2");
const button3 = document.querySelector("#button3");
const text = document.querySelector("#text");
const xpText = document.querySelector("#xpText");
const healthText = document.querySelector("#healthText");
const goldText = document.querySelector("#goldText");
const monsterStats = document.querySelector("#monsterStats");
const monsterName = document.querySelector("#monsterName");
const monsterHealthText =document.querySelector("#monsterHealth");

// initialize buttons
button1.onclick = goStore;
button2.onclick = goCave;
button3.onclick = fightDragon;


/* User Editable Region */

function goStore() {
  button1.innerText = "You enter the store.";
  button2.innerText = "You enter the store.";
  button3.innerText = "You enter the store.";
  button1.onclick = buyHealth;
  button2.onclick = buyWeapon;
  button3.onclick = goTown;
}

/* User Editable Region */


function goCave() {
  console.log("Going to cave.");
}

function fightDragon() {
  console.log("Fighting dragon.");
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

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

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

What did you try so far?

1 Like

you must to add a text.innerText with the property “You enter the store.”

1 Like

Thank you so much. Got it to work

1 Like

it works but its so complicate to understand , i read it many times but nothing , i just see here , hint is not clear or what it wants

Submit a new thread in the forum with your confusion. You can get the answer quicker that way. Hope this helps

2 Likes

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