Build a Wildlife Tracker - Step 12

Tell us what’s happening:

Wildlife Tracker Step 12
My code is correct
const getProperty=(animal, propertyName)=> {
const property = propertyName;
return animal[property];
}
console.log(getProperty(tiger, “species”));
console.log(getProperty(elephant,“age”));

but i get an error that I have to use bracket notation Nd cannot complete. But in fact I am using bracket notation - looks like a bug

Your code so far

const tiger = {
  species: "Tiger",
  age: 5,
  isEndangered: true
};

const elephant = {
  species: "Elephant",
  age: 10,
  isEndangered: true
};

const getSpecies = (animal) => {
  return animal.species;
};

console.log(getSpecies(tiger));

const getAge = (animal) => {
  return animal.age;
};

console.log(getAge(tiger));

const addHabitat = (animal, habitat) => {
  animal.habitat = habitat;
  return animal;
};

console.log(addHabitat(tiger, "Rainforest"));

const updateAge = (animal, newAge) => {
  animal.age = newAge;
  return animal;
};

console.log(updateAge(elephant, 12));

const removeEndangeredStatus = (animal) => {
  delete animal.isEndangered;
  return animal;
};

console.log(removeEndangeredStatus(tiger));

const hasHabitat = (animal) => {
  return animal.hasOwnProperty("habitat");
};

console.log(hasHabitat(tiger));
console.log(hasHabitat(elephant));

// User Editable Region
const getProperty=(animal, propertyName)=> {
   const property = propertyName;
   return animal[property];
}
console.log(getProperty(tiger, "species"));
console.log(getProperty(elephant,"age"));

// User Editable Region

Your browser information:

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

Challenge Information:

Build a Wildlife Tracker - Step 12

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-wildlife-tracker/6999b0d79ea938edcb032237.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @NadiaSz

You don’t need to reassign the parameter, just use it directly, otherwise you are creating unnecessary code.

Happy coding