SyntaxError: unknown: Unexpected keyword 'var'. (4:0)

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

Please help, it says
SyntaxError: unknown: Unexpected keyword ‘var’. (4:0)

  **Your code so far**
const myDog = {
// Only change code below this line

name: "Rowdy"
legs: 4,
tails: 1,
friends: ["food"]

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

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0

Challenge: Build JavaScript Objects

Link to the challenge:

SyntaxError: unknown: Unexpected token, expected "," (6:0)

  4 |
  5 | name: "Rowdy"
> 6 | legs: 4,
    | ^
  7 | tails: 1,
  8 | friends: ["food"]
  9 |

You are missing a comma

i have tried everything, what line please

can you explain that please

@udaaff Showed you what line. There is an error on line 6 because of the missing comma on line 5. All of the key/value pairs in an object must be separated by a comma.

const myDog = {
// Only change code below this line

var myDog = {
“name”: “Rowdy”,
“legs”: 5,
“tails”: 1,
“friends”: [“food”],

// Only change code above this line

You should not create the same var second time

thats my code, do i need a second comma on the line?

We were discussing the code you posted in the first message.

i have changed var to myCat, same error.

The object is already created for you, no need to define another one. You have to only change it contents.

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