Here is one possible solution to this exercise:

// 1. Log the keys of the following object as an array
const pizza = {
  name: 'pepperoni',
  price: 8,
  toppings: ['marinara', 'cheese', 'pepperoni']
};
const keys = Object.keys(pizza);
console.log(keys);

// 2. Loop over the above keys and print the keys to the console in all caps
for (const key of keys) {
  console.log(key.toUpperCase());
}

// 3. Convert the above object to a string, stored in a variable, and print it to the console with all the keys and spacing set to 3
const stringPizza = JSON.stringify(pizza, null, 3);
console.log(stringPizza);

// 4. Convert the above object to a string but remove the price of the pizza and spacing set to 2
const stringPizza2 = JSON.stringify(pizza, ['name', 'toppings'], 2);
console.log(stringPizza2);

// 5. Take the string representation of the pizza object from 3 or 4 and convert it back to an object. Print the object to the console.
const converted = JSON.parse(stringPizza2);
console.log(converted);

You can view this solution on StackBlitz here.

 

I finished! On to the next chapter