Need help with this Javascript assignment

function exerciseTwo(animal){
// Exercise Two: In this exercise you will be given an object called ‘animal’
// Create a new variable called ‘animalName’
// Accessing the animal object, assign the ‘animalName’ variable to the ‘latinName’ key on the object.
// return the animalName variable.

const animalName = {};
animalName.latinName;

return animalName;
}

Let’s break it down.

  1. Create a new variable called ‘animalName’. => How do you declare a variable and assign it a value? const animalName={} produces an object. You already have animal for an object, don’t produce another one.
  2. Accessing the animal object, assign the ‘animalName’ variable to the ‘latinName’ key on the object. animalName.latinName would access the ‘latinName’ key of the ‘animalName’ object. You need to assign the value for the animal object.
  3. Return the animalName variable. return animalName meets this condition.

This is what I got from what u mention, something is still missing

const animalName = {};
animalName.latinName;

return animalName;

You… didn’t change anything.

  1. Assign a value to the animalName variable, not an {} object.

  2. Assign the animalName variable to the latinName key of the animal object.

so I don’t have to make a new object?

Nope. The instructions say the animal object was already defined.

1 Like

This is what I got now but still missing something, ugg im still a noob ig

const animalName
animalName.latinName;
return animalName;

You need to assign the animalName value to the latinName key of the animal object.
Let’s review object-key notation. object[key] = value.
Does that help?

LIke this?

const animalName;
animal[latinName] = animalName;
return animalName;

Yep. Now assign a value to const animalName.

1 Like

thx man that helped a lot!

1 Like

Awesome! I’m glad I could help! Make sure you take some time to celebrate your success!

1 Like