Outline

Here is a possible solution to our console.assert exercise. You were asked to use console.assert to display:

1️⃣ Create & initialize worstPizza and bestPizza variables with different values

2️⃣ Do an assertion of worstPizza == bestPizza

3️⃣ The error message should have multiple strings and these two variables passed

4️⃣ Do the assertion again, but the second argument should be an object

5️⃣ The object should have worstPizza and bestPizza as attributes, and an errorMessage attribute

const bestPizza = "bbq chicken";
const worstPizza = "anchovies";

console.assert(
  bestPizza == worstPizza,
  worstPizza,
  "is not as good as ",
  bestPizza
);

console.assert(bestPizza == worstPizza, {
  bestPizza,
  worstPizza,
  errorMessage: `${worstPizza} is not as good as ${bestPizza}`
});

Stackblitz Solution

 

I finished! On to the next chapter