Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Bring Me a MAP!

“We demand,” announces the tallest Knight, “a MAP!”

“You already have objects.”

“Objects only take string keys! We demand a real Map! One that accepts objects as keys! And preserves insertion order! And has a .size property that doesn’t require counting!”

Someone presents (new Map).

The Knights inspect it. Any key type. Guaranteed insertion order. .size. Direct for-of iteration. No prototype pollution.

“That is… acceptable.”

“NI! Now bring us a Set!”

“With no duplicates!”

“That’s… what a Set is.”

“WE KNOW WHAT A SET IS! Bring us one anyway! NI!”