How do I clone a Javascript class instance using ES6.
I\'m not interested in solutions based on jquery or $extend.
I\'ve seen quite old discussions of object
Another one liner:
Most of the time...(works for Date, RegExp, Map, String, Number, Array), btw, cloning string, number is a bit funny.
let clone = new obj.constructor(...[obj].flat())
for those class without copy constructor:
let clone = Object.assign(new obj.constructor(...[obj].flat()), obj)