r/javascript • • May 28 '19

What are some JavaScript things beginners don't know?

333 Upvotes

383 comments sorted by

View all comments

1

u/richieahb May 28 '19 edited May 28 '19

The idea of references. This comes up in so many places:

  • Mutability (and all the associated CS concepts that go with it: pure functions, race conditions etc.)

  • Triple equals equality on objects (which compares their references) an example being: a lot of React (although by no means only React) uses memoization for performance gains and comparison of references (functions, props.children, other objects) is the first place memoization usually fails

  • Garbage collection (and related memory leaks from things not being GCd) and things that build on this like WeakMaps and WeakRefs / FinalizationGroups (the latter currently just being a proposal).

  • Passing by value / reference to functions

  • The reason that there is both let and const.

I’m sure I’m missing some places!