Setting an object generator through a computed property in JavaScript

In the previous lesson, we assigned a generator for an object with a separate command. This was our object:

javascriptlet obj = {
  a: 1,
  b: 2,
  c: 3,
};

This is how we set up the generator:

javascriptobj[Symbol.iterator] = function *() {
  for (let key in this) {
    yield obj[key];
  }
}

In fact, we can rewrite our code in another way with computed property:

javascriptlet obj = {
  a: 1,
  b: 2,
  c: 3,
  [Symbol.iterator]: function *(){
    for (let key in this){
      yield this[key];
    }
  }
};

Let's check our loop:

javascriptfor (let elem of obj) {
  console.log(elem); // 1, 2, 3
}
Задание 1

Rewrite the solution to the task from the previous lesson with a computed property.