Built-In and Custom Traits in JavaScript

Picture of various fruits in bins at a market: apples, oranges, pomegranates, etc.
Picture of various fruits in bins at a market: apples, oranges, pomegranates, etc.
Photo by Jakub Kapusnak on Unsplash

The Problem:

Changing Language Behavior:

Fibonacci Iterator:

Runtime and Static Analysis:

The Pattern: Imitate and Extend Well-Known Symbols

State in Trait Protocols and Implementations:

Generic Implementations:

Interaction with TypeScript:

Conclusion:

Resources:

I write a lot of ECMAScript… enough to have plenty of mistakes to learn from.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store