Hello,
I'm looking to clone an object and all of its sub-objects (and their properties) into a new object with a different name, but I didn't see a way of doing this in SugarCube 2's documentation. I saw quite a few methods of doing this through JavaScript/jQuery on stackoverflow, but I'm not familiar enough with JS to know which method would be 'proper' in this situation.
Side question:
I noticed that you can group variable assignments and object creation with the Set macro, like so:
Individually:
Grouped:
Is there any benefit to doing it one way over the other?
Thank you for your time.
I'm looking to clone an object and all of its sub-objects (and their properties) into a new object with a different name, but I didn't see a way of doing this in SugarCube 2's documentation. I saw quite a few methods of doing this through JavaScript/jQuery on stackoverflow, but I'm not familiar enough with JS to know which method would be 'proper' in this situation.
Side question:
I noticed that you can group variable assignments and object creation with the Set macro, like so:
Individually:
<<set $foo to {}>> <<set $foo.bar to {}>> <<set $foo.bar.foobar to {}>> ...
Grouped:
<<set $foo to {}, $foo.bar to {}, $foo.bar.foobar to {}, ... >>
Is there any benefit to doing it one way over the other?
Thank you for your time.