I’m talking specifically about the ‘Learn Basic JavaScript by building a Role Playing game’ course, step 13. The instruction is " Change your inventory
variable to be an array with the strings "stick"
, "dagger"
, and "sword"
." , and when I write the code and hit ‘Check your Code (Ctrl + Enter)’ it doesn’t do anything, not even showing a syntax error or something. Not sure what to do here. Thanks.
Hey, welcome to the forums. When nothing happens when you click the Check Your Code button that usually means there is a syntax error with your code. We’ll need you to paste your code in here so we can see what you did.
To enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
let inventory = "stick", "dagger", "sword";
If you mean the whole code so far, here it is:
let xp = 0;
let health = 100;
let gold = 50;
let currentWeapon = 0;
let fighting;
let monsterHealth;
let inventory = "stick", "dagger", "sword";
Been following instructions step by step
Look closely at the example array in the instructions. What does that array have that yours is missing?
Oh, thanks. I see it now. I was worried since this is the first time I clicked on the button and nothing happens. When the code misses something it usually shows an error with a big X. Anyways, thanks for helping.
It’s probably a good idea to have the Console pane open when doing the JS courses. You’ll see these types of errors in there.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.