1
JS Assignment 11: Intro to Objects
Paultheriault (0)

//This one has got me stumped. Any hints or advice would be greatly appreciated.//

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.

}

You are viewing a single comment. View All
1
heyitsmarcus (280)

@Paultheriault You are very close! Remember animalName is just a variable itself. And when you're accessing properties of an object, you do object.property (or object[property] but that will come later).

So, you need:

//animalName is assigned the value stored in animal's property "latinName"
let animalName = animal.latinName;
return animalName;

So, to put it all together:

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.

  //animalName is assigned the value stored in animal's property "latinName"
  let animalName = animal.latinName;
  return animalName;
}