I keep trying the code and following the example here and the example on the video and it keeps telling me its wrong

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

   **Your code so far**

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

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

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36

Challenge: Build JavaScript Objects

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.


Do you have code you have tried to write?

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

const myDog = {
"name": "Bumi",
"legs": "4",
"tails": 1,
"friends": "everyone".
};

This is the code i have used but i did have variable instead of constant and it did the same thing.

This part can’t be right. You shouldn’t be trying to declare a variable inside of a variable definition here.

I keep using var and it still isn’t correct.

var myDog = {
"name": "Bumi",
"legs": "4",
"tails": 1,
"friends": "everyone".
};

This is what it says

SyntaxError: unknown: Unexpected keyword 'var'. (3:1)

  1 | const myDog = {
  2 |  // Only change code above this line 
> 3 |  var myDog = {
    >  ^
  4 | "name": "Bumi",
  5 | "legs": "4",
  6 | "tails": 1,

It isn’t a matter of const vs var. It is a matter of you creating a variable inside of a variable.

Do not write const myDog = { twice. Do not write const myDog = { followed by var myDog = {. That makes no sense to the JS interpreter.

Hi @Vick51193 your variable is already declared
const myDog = {

Read the instructions again carefully:

Make an object that represents a dog called myDog which contains the properties name (a string), legs , tails and friends .

Therefore you are adding the properties to the object. An object property is made up of the ( key : value; ) Key being the name of the property and after the colon the value of that property.
Again read the instructions carefully. Pay attention to String, Numbers, Array.

Yes i am trying to build javascript objects and i have tried this for 2 weeks now and every variable i put in pulls up wrong and i go by the hint and the video and i was wondering if you can see what i am doing wrong because i am not seeing it. I sent the code a few times and im not sure where i am going wrong with it?

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

/// LOOK RIGHT HERE AND DELETE THIS
const myDog = { 
/// SERIOUSLY ACTUALLY DELETE THIS

DO NOT write const myDog twice in your code. Remove this spot where you typed it a second time.

Don’t replace const with var. Just delete the entire line. It should not be there at all.

2 Likes