Mastering JavaScript Collections: Arrays, Maps, Sets, and Beyond
summary
Covers concrete tradeoffs: use typed arrays for big numeric/binary workloads to get much better performance; prefer Map over plain objects to avoid prototype-key collisions and to accept non-string keys with generally better lookup speed; remove duplicates with [...new Set(array)]; use WeakMap caching or WeakSet when holding many large objects so the garbage collector can free keys and prevent OOM; Maps don’t JSON-serialize directly and a TypeScript .js library adds more collection types and generics.
AI-written summary · about
chapters (10)
- 0:00JavaScript collections intro
- 1:05JavaScript arrays deep dive
- 4:16Objects vs arrays for storage
- 6:24Working with Maps
- 9:36Maps vs objects
- 11:00Sets for uniqueness
- 13:33WeakSet for garbage collection
- 15:42WeakMap for caching
- 19:44External collections libraries
- 20:50Choosing the right collection
related talks
42mES6 Collections in V8: There's Neon Inside
40mA Tale of Types, Classes, and Maps
55mWhy JavaScript Programmers Should Learn Algebraic Data Types
34mJavaScript is an Oddball
27mThe Life of a JavaScript Feature in V8 ft. TypedArrays
46mInvisible performance. How fast is your JavaScript code?
56mThe Better Parts
49mJavaScript: The Fascinating Parts
