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

Tell us what’s happening:

not sure whats wrong i cant get this to pass ive tried everything i can think of

Your code so far

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

/* file: styles.css */

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

const weapons = [{name:"stick", power: 5}, {name:"dagger", 30}, {name:"claw hammer", 50}, {name:"sword", 100}];

// 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/130.0.0.0 Safari/537.36

Challenge Information:

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

Hi there. There are red squigglies in the editor. That’s an indication of an error in your code. If you hit the console button, it should have more information for you.

ya now im even more confused the console says Your

weapons

array should have four values. 2. Your

weapons

array should have four objects. 3. Your first

weapons

object should have the

name

set to

"stick"

and the

power

set to

5

. 4. Your second

weapons

object should have the

name

set to

"dagger"

and the

power

set to

30

. 5. Your third

weapons

object should have the

name

set to

"claw hammer"

and the

power

set to

50

. 6. Your fourth

weapons

object should have the

name

set to

"sword"

and the

power

set to

100

and as far as i can tell it is i even went to the next project and checked it looks exactly the same as mine right now

Hi @ryanstruckus

Add four objects to the weapons array, ✓ ✓✓✓
each with two properties: ✓ ✗ ✗ ✗

Happy coding

so there is only one with two properties ? and wich one because as far as i can tell the format is the same with all of them

I reformatted your code.

ok i still dont know wich ones right and wich ones wrong because acorrding to the online guide i looked at they all should be right

k i add simi colons at the start of the second property but still the same error

const weapons = [{name:"stick", power: 5},
{name:"dagger", : 30 }, 
{name:"claw hammer", : 50 },
{name:"sword", : 100 }

You also need to include the property names.

so it would be like this

const weapons = [{name:"stick", power: 5},
{name:"dagger", power: 30 }, 
{name:"claw hammer", power: 50 },
{name:"sword", power: 100 }
1 Like

Your code is missing a square bracket at the end for the array.