benleggiero
07/27/2017, 12:07 PMfoo (let's say it's 1GB) and then you say var bar = foo, a "copy" is made, yes. And I'm not 100% sure how, but no delay is incurred. I suspect that you get a new pointer, and any changes you make are reflected as diffs.
Also, let foo = "foo"; let bar = foo, IIRC, makes foo and bar point to the same memory, which is safe because neither can be mutated.voddan
07/27/2017, 1:01 PMvoddan
07/27/2017, 1:02 PMvar bar = foo nothing happens until you mutate bar. Then the whole 1GB is copied.voddan
07/27/2017, 1:04 PM