|
|
|
|
|
by bevr1337
69 days ago
|
|
> Pass references around to objects, not recreate them each time at some function boundary. Non-primitives are always pass-by-reference. There's no mechanism to pass a non-primitive by value except edge-cases like giving ownership of a buffer to another process. > destructuring What about it? What backs the assumption that destructuring is inherently worse than dot and/or bracket syntax? Is there a behavior you think is unique to destructuring? Or maybe a specific report from one engine years ago? |
|
it's a good thing. pass objects by reference.
> Is there a behavior you think is unique to destructuring?
depending on exact syntax, will collect values in another array or object. it's often used as the mirror-pattern of using named variables, which allocates an object for each function call.
in isolation these are not inherently wrong, at scale they start to add up. and should not be used in tight loops.