Subverting control with weak references

Weak references are neat. The best language features unlock different kinds of abstractions, and weak references do exactly that. Let me show you why. In JavaScript we have two APIs to work with weak references: WeakMap and WeakRef . (Before I wrote this article I thought WeakRef was only a proposal, but it turns out most browsers have already implemented it) One of the more common use cases uses…