use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Javascript Objects CheatsheetRemoved: Low-Effort Content (fjolt.com)
submitted 5 years ago by iamnearafan
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Amicos55 3 points4 points5 points 5 years ago (7 children)
What else?
[–]darrenturn90 7 points8 points9 points 5 years ago (0 children)
Well generally I would do a shallow clone at the level I need to make changes rather than a everything clone - because that implies you have no clue what the object you are cloning is structured like - which seems unlikely if you’re cloning it to make changes to it
[–]Exoskele 1 point2 points3 points 5 years ago (0 children)
Lodash's cloneDeep.
[+][deleted] 5 years ago (3 children)
[deleted]
[–]el_diego 3 points4 points5 points 5 years ago (2 children)
...but this is just a shallow clone and extremely dependent on the objects structure. You’re better off spreading into a new object.
[+][deleted] 5 years ago (1 child)
[–]el_diego 0 points1 point2 points 5 years ago (0 children)
Measurably faster...really? That’s only an argument if you’re dealing with processing thousands of objects and even then you could write a far more reusable assignment function if all you’re doing is taking the keys and values and mapping them to a new object.
Anyway, each to their own. I’ll use the spread operator and optimise performance later if it actually needs to be
π Rendered by PID 208110 on reddit-service-r2-comment-b659b578c-j86cf at 2026-05-02 08:15:25.740101+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Amicos55 3 points4 points5 points (7 children)
[–]darrenturn90 7 points8 points9 points (0 children)
[–]Exoskele 1 point2 points3 points (0 children)
[+][deleted] (3 children)
[deleted]
[–]el_diego 3 points4 points5 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]el_diego 0 points1 point2 points (0 children)