How is this a wrong answer?

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

const myDog = {
// Only change code below this line
var myDog = {
"name": "Jasper",
"legs": 4,
"tails": 1,

// Only change code above this line
  **Your browser information:**

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

Challenge: Build JavaScript Objects

Link to the challenge:

You declared the variable inside of the variable… That can’t be right.

I tried const instead of var that didn’t work either…

this does not work either

What do the failing tests say?

SyntaxError: unknown: Unexpected keyword ‘const’. (3:0)

1 | const myDog = {
2 | // Only change code below this line

3 | const myDog = {
| ^
4 | “name”: “Jasper”,
5 | “legs”: 4,
6 | “tails”: 1,

You still declared a variable inside of a variable. You shouldn’t do that.

They didn’t do that in the example

const cat = {
  "name": "Whiskers",
  "legs": 4,
  "tails": 1,
  "enemies": ["Water", "Dogs"]

So how should it look?

It worked haha I removed the variable like you said. I was just so used to always having a variable in all the previous tests. Thank you for your help.

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