r/javascript • • Apr 28 '19

7 Useful JavaScript Tricks

https://davidwalsh.name/javascript-tricks
505 Upvotes

36 comments sorted by

View all comments

-5

u/timarama Apr 28 '19

great article, tricks with spreading set and creating "pure" objects show 2 sides of JS:

1 - expressing things with short, elegant expressions, but not very good about performance

2 - if you want, you CAN care about performance and memory usage of your JS apps

5

u/__ibowankenobi__ Apr 28 '19

FYI, when you create a pure object, it has no impact on memory whatsoever, because those function's from Object.prototype are never copied. And I really really doubt they have performance benefits.

0

u/[deleted] Apr 29 '19

[deleted]

1

u/__ibowankenobi__ Apr 30 '19

Yes, technically that would save you 8 bytes.