Build a Recipe Tracker - Step 7

Tell us what’s happening:

This is a question that is really confusing me, the last paragraph says

Also delete the recipe1Name, recipe2CookingTimebut the confusing part is if I should usedeleteor just removes the lines. I been trying to usedelete recipe1Name` but it doesn’t seem to work.

Your code so far

const recipes = [];

const recipe1 = {
  name: "Spaghetti Carbonara",
  ingredients: ["spaghetti", "Parmesan cheese", "pancetta", "black pepper"],
  cookingTime: 22,
  totalIngredients: null,
  difficultyLevel: ""
};

const recipe2 = {
  name: "Chicken Curry",
  ingredients: ["chicken breast", "coconut milk", "curry powder", "onion", "garlic"],
  cookingTime: 42,
  totalIngredients: null,
  difficultyLevel: ""
};

const recipe3 = {
  name: "Vegetable Stir Fry",
  ingredients: ["broccoli", "carrot", "bell pepper"],
  cookingTime: 15,
  totalIngredients: null,
  difficultyLevel: ""
};

// User Editable Region
const recipe1Name = recipe1.name;
console.log(recipe1Name);

const recipe2CookingTime = recipe2.cookingTime;
console.log(recipe2CookingTime);

const recipe3Ingredients = recipe3.ingredients;
console.log(recipe3Ingredients);

recipes.push(recipe1, recipe2, recipe3)
// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36

Challenge Information:

Build a Recipe Tracker - Step 7

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-recipe-tracker/66fbcf750a62784cf11f5630.md at main · freeCodeCamp/freeCodeCamp · GitHub

I’m running into the same confusing point: delete recipe1Name won’t remove a const binding, because const declarations are lexical bindings rather than object properties. The delete step likely needs to target the relevant property on an object instead, while the standalone variable declaration remains in scope.

Hi @mahassan,

That is the intention.

Happy coding