Chapter 10. The New ECMAScript Standard Objects

In Part I, we examined the objects that have been a part of JavaScript from the beginning: the global object (window in the browser), Object, String, Number, Boolean, Math, Date, Array, and Function. Beginning with ECMAScript 6, also known as ECMAScript Next and ES 6, we now have new constructs: Map, WeakMap, Set, WeakSet, Symbol, Class, Proxy, and Promise.

Though it’s technically not an object, I also decided to include a discussion of let in this chapter. I wanted to demonstrate to you the difficulties with handling cross-browser differences for a new language construct, such as let, yield, const, and others, as compared to how we can handle the differences for objects.

For the most part, you can manage browser differences for object support using a polyfill. I recommend using Paul Miller’s ES 6 Shim. You can also use Google’s Traceur, covered in Creating a True Class and Extending It (with a Little Help from Traceur).

If you’re concerned about which browser or environment currently supports what objects, the following are a list of references that can help you discover this information:

Caution

Even if you use a polyfill or other tool, you’ll need to test your use of ES 6 features in every target browser if you plan on using them in production. ...

Get JavaScript Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.