O'Reilly logo

JavaScript Cookbook, 2nd Edition by Shelley Powers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required