0

Let's say i have an object that looks like this:

function object () {
     this.property = false;

     this.function = function () {
          return !property;
     }
}

Then i create a copy of an instance of this object like so:

let copy = JSON.Parse(JSON.stringify(object));

This only copies the properties of the object, not the functions, how do i do that?

Bebet
  • 199
  • 2
  • 12

0 Answers0