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

[JavaScript Algorithms and Data Structures (Beta) step-14]
Hi team,
I am unable to assign a value to my variable in an array
pls help
T.I.A

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./styles.css">
    <title>RPG - Dragon Repeller</title>
    <script src="./script.js"></script>
  </head>
  <body>
    <div id="game">
    </div>
  </body>
</html>
/* file: script.js */

// User Editable Region

let xp = 0;
let health = 100;
let gold = 50;
let currentWeapon = 0;
let fighting;
let monsterHealth;
let inventory = ["stick", "dagger", "sword"];
inventory =="stick";

// User Editable Region

Your browser information:

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

Challenge Information:

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

Hi! You have to remove these values manually and put a “stick” instead, that’s all :slightly_smiling_face:

1 Like

Hi thanks for the reply,
I tried doing that too however it says that the variable should be an array as well
pls recommend

Sure, an array with only one value:

["value"];

I am so sorry, I could not understand the above statement
Could you pls ease it for me by typing the specific code if possible
thank you so much
(sorry for the inconvenience)

1 Like

No problem. In this step you have an array inventory with three values:

let inventory = ["stick", "dagger", "sword"];

Your task is to change it to have only one starting value “stick”.
So you need to remove “dagger” and a “sword”.
The result would look like:

let inventory = ["value"];

1 Like

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