I believe this issue may be a bug for this step. I think the screenshot explains it well enough, but I think this step has multiple parts to it, and completing the first step triggers an error indicating that the other steps are missing, but we haven’t been directed to complete those steps yet. I’m planning to go ahead and add the remaining steps to see if that gives a correct response, but thought it worth mentioning, since this version is still in beta. Or, if I am messing it up because I’m still learning, please show me where I put the wrong thing in (I have double checked for extra/missing symbols, etc)…
Hey @a.romano2010
Kindly if you don’t mind could you post your code not the screen shot
I was directed to add
{
name: “store”
}
only in this step, but it triggered an error because the remaining steps weren’t present.
code below:
const locations = [
{
name: “town square”,
“button text”: [“Go to store”, “Go to cave”, “Fight dragon”],
“button functions”: [goStore, goCave, fightDragon],
text: “You are in the town square. You see a sign that says "Store".”
},
{
name: “store”
}
];
This is the full error code:
// running tests Your second
locations
object should have a
button text
property which is an array. Your
button text
property should have the string values
Buy 10 health (10 gold)
,
Buy weapon (30 gold)
, and
Go to town square
. Your second
locations
object should have a
button functions
property which is an array. Your
button functions
property should have the function values
buyHealth
,
buyWeapon
, and
goTown
. Your second
locations
object should have a
text
property which is a string. Your second
locations
object should have a
text
property with the value of
You enter the store.
. // tests completed // console output [TypeError: locations[1][‘button text’] is undefined] [TypeError: locations[1][‘button functions’] is undefined]
Sorry for that It happens to us all the time
the instructions say
Add a second object to your locations
array (remember to separate them with a comma). Following the pattern you used in the first object, create the same properties but use the values from the goStore
function. Set the name
property to store
.
They have only given the name to be changed to “store” but the rest of the object properties are supposed to be copied from your goStore function which is this one here
function goStore() {
button1.innerText = "Buy 10 health (10 gold)";
button2.innerText = "Buy weapon (30 gold)";
button3.innerText = "Go to town square";
button1.onclick = buyHealth;
button2.onclick = buyWeapon;
button3.onclick = goTown;
text.innerText = "You enter the store.";
}
So you need to get the button text from the goStore function,button functions from here too.
Hope you understand
When I jumped ahead and added everything into the first step, it cleared without a problem. I definitely think it’s a bug, since I was never directed to add those other items in my instructions.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.