Say I have an existing object, a and prototype b. I want to create a new object c, with values a, but prototype b. Is there a better way than the following:
function Copy(object) { Object.assign(this, object); } Copy.prototype = Object.create(b); var c = new Copy(a);
Edit: Is Object.setPrototypeOf better or worse than resolving the issue?
Jacob source share