Back to Freecodecamp

Step 4

curriculum/challenges/english/blocks/workshop-recipe-tracker/66fbcf750a62784cf11f562e.md

latest2.2 KB
Original Source

--description--

Create a recipe2 object with the following properties and values:

KeyValue
nameChicken Curry
ingredients["chicken breast", "coconut milk", "curry powder", "onion", "garlic"]
cookingTime42
totalIngredientsnull
difficultyLevel""

--hints--

You should create an object named recipe2.

js
assert.isObject(recipe2);

Your recipe2 object should have a name property.

js
assert.property(recipe2, "name");

Your name property should be set to Chicken Curry.

js
assert.equal(recipe2.name, "Chicken Curry");

Your recipe2 object should have an ingredients property.

js
assert.property(recipe2, "ingredients");

Your ingredients property should have an array value.

js
assert.isArray(recipe2.ingredients);

The array value of your ingredients property should have chicken breast, coconut milk, curry powder, onion and garlic in it.

js
assert.deepEqual(recipe2.ingredients, ["chicken breast", "coconut milk", "curry powder", "onion", "garlic"]);

Your recipe2 object should have a cookingTime property.

js
assert.property(recipe2, "cookingTime");

Your cookingTime property value should be a number.

js
assert.isNumber(recipe2.cookingTime);

Your cookingTime property should be set to 42.

js
assert.equal(recipe2.cookingTime, 42);

Your recipe2 object should have a totalIngredients property.

js
assert.property(recipe2, "totalIngredients");

Your totalIngredients property should be set to null.

js
assert.isNull(recipe2.totalIngredients);

Your recipe2 object should have a difficultyLevel property.

js
assert.property(recipe2, "difficultyLevel");

Your difficultyLevel property should be set to an empty string.

js
assert.deepEqual(recipe2.difficultyLevel, "");

--seed--

--seed-contents--

js
const recipes = [];

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

--fcc-editable-region--

--fcc-editable-region--