Collections & Object Utilities
Set, WeakSet, and the built-in static methods on Object for working with keys, values, and immutability.
Set
A Set stores unique values of any type no duplicates, and (like Map) it remembers insertion order.
WeakSet
Like Set, but can only hold objects (not primitives), and those objects are held weakly if nothing else references an object, it can be garbage collected even while still "in" the WeakSet. Not iterable, and has no .size. Useful for tracking membership (e.g. "has this object already been processed?") without preventing garbage collection.
Object static methods
Object.keys() / Object.values() / Object.entries()
Object.assign()
Copies properties from one or more source objects into a target object (mutates the target, returns it):
Object.freeze() / Object.isFrozen()
Prevents adding, removing, or reassigning properties (shallow nested objects are still mutable):
Object.seal() / Object.isSealed()
Prevents adding or removing properties, but existing properties can still be reassigned (unlike freeze):