Book Review: Understanding ECMAScript 6

Nicholas Zakas
Understanding ECMAScript 6

ECMAScript 6, aka ES6, is the 6th edition of ECMAScript specification. Released in 2015, ES6 adds many new features for writing complex web applications:

  1. Classes and Modules
  2. Promises
  3. Arrow Functions
  4. Symbols
  5. Sets and Maps
  6. Iterators and Generators
  7. Proxies and Reflection

For a number of years, I felt uncertain about building high-complexity JavaScript applications. Even best examples lacked organizational and interface clarity and testability and often produced unintentional side-effects. ES6 is a giant step forward in allowing developers create clean and intention-revealing JavaScript code.

Today, ES6 has become the foundation for building modern web applications. Understanding ES6 is now essential for all web developers. Nicholas' book will help you get started. It is well organized, easy-to-read, and especially well-suited for developers with previous ECMAScript 5 experience. Each chapter highlights the problem addressed by ES6, demonstrates what had to be done previously in ECMAScript 5, and how the code changes in ES6.

This is a great ES6 book. Find it on LeanPub. Happy reading!

IE 8 and Dojo 1.1 issues resolved by upgrading to Dojo 1.3

According to our web statistics, IE8 user base is growing fast at the expense of IE6 and IE7 users. This prompted us to test our web applications using IE8 and, as a result, we discovered a number of CSS and JavaScript compatibility issues.

Most of the JavaScript problems were related to the Dojo 1.1 JavaScript toolkit and all of them have been resolved by upgrading to Dojo 1.3.

If you are wondering which browsers your applications should support, we recommend establishing a rule based on a percentage of your user base. For example, we support 95% of our users, which results in IE 6/7/8, Firefox 3, Chrome 2, and Safari 3 browsers.

Happy coding!

Dojo 1.1, Firefox 3.0.5, and this._getText is not a function

We run into an interesting problem with Dojo 1.1 running on Firefox 3.0.5. The page works well on Firefox 2, IE 6/7, Safari 2/3, but once in a while, it does not load correctly on Firefox 3. It may also throw one or more JavaScript exceptions. For example, "failed loading undefined./currency.js with error: TypeError: this._getText is not a function".

My hunch is that it happens because dojo.require statements are not handled correctly. It is also possible that this issue is related to another issue reported on the Dojo forum: http://dojotoolkit.org/forum/dojo-foundation/general-discussion/firefox-3-fires-domcontentloaded-event-prematurely.

The good news is that we tested the problem on the alpha version of Firefox 3.2 (Minefield - http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-central/) and it seemed to be resolved. We also found a work-around to make Dojo 1.1 more stable on Firefox 3.0.5: loading base dojo libraries via script tags instead of the dojo.require function. The JavaScript exceptions still appear from time to time, but much more rarely.

If you have any insight into this issue, please, let us know. Your help would be very appreciated. Thank you. Happy coding!

JavaScript tags cannot be self-closing

I was puzzled today by the following exception coming out of one of our web application: this._form has no properties. The exception occurred even on simple pages that had a form and a Script Manager tag. After troubleshooting the issue, I traced it down to the script tag on the site master page. Apparently, JavaScript tags cannot be self-closing.  

Replacing 

             <script language="javascript" type="text/javascript" src="my.js"/> 

with  

             <script language="javascript" type="text/javascript" src="my.js"></script>  

resolved the issue. Happy coding!

Is it possible to load an swf movie in FireFox without a page refresh?

We are building an Ajax web application, where a user could click on a link to play a flash swf file. In its simplest form, a web page consists of a set of links and a <div/> container where flash videos are played. The important requirement is to avoid a page refresh after the user makes her/his selection.

In IE, this is achieved by setting the movie property of the flash <object/> element. For the same purpose in FireFox, you have the src property of the <embed/> element and the data property of the flash <object/> element. However, they do not seem to do the trick...

Do you have any ideas why? Thank you in advance for your help.

Welcome to ModelBlog

Thank you for visiting ModelBlog. We hope the time you spend with us will be both entertaining and worth your while. Have fun!

Authors

Search

Archive

Tags