In the code below, I was trying to create a constructor object, then I wondered does it work as a function while It is an object ...It actually works but the result is not desirable...like it ignores "jack" and "joe" as an property in the object but when I use it as a pure object it works properly... I wanted to know is this action logical or not??
function Lome() {
      let object1 = { z: 15, h: 67 };
      this.jack = 16;
      this.joe = { x: 5, y: 8 };
      Object.defineProperty(this, "john", {
        get() {
          return object1;
        },
        set(value) {
          object1 = value;
        },
        enumerable: true,
      });
      return object1;
    }
    const lara = new Lome();
    lara.john = 6;
    console.log(Lome());
    //{ z: 15, h: 67 };
    console.log(JSON.stringify(lara));
    //{"z":15,"h":67,"john":6};
 
    