Customizing ES6 via well-known symbols
In ECMAScript 6, the object Symbol has several properties that contain so-called well-known symbols ( Symbol.iterator , Symbol.hasInstance , etc.). These let you customize how ES6 treats objects. This blog post explains the details. Warning Implementation of the features described here is work in progress. Consult the “ ECMAScript 6 compatibility table ” for what is supported where (spoiler: not much, in few engines). Background This section covers knowledge that is useful for the remainder of this post. Additionally, the following material may be of interest: Chapter “ Symbols ” in “Exploring ES6” Chapter “ Values ” (primitive values versus objects, etc.) in “Speaking JavaScript” Internal properties The ES6 specification uses internal properties to describe how JavaScript works. These are only known to the spec and not accessible from JavaScript. They may or may not exist in an actual implementation of the language. The names of internal properties are written in double square brac...