Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

jobs.webdeveloper.com

e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


The New JavaScript - a.k.a. EcmaScript 5

Bookmark and Share

by Curtis Dicken

September 22, 2009

JavaScript is one of the most widely used programming languages used on the web and with the new release coming we have one question. Are you ready?

Introduction

What the heck is EcmaScript you say? Well, EcmaScript is the core set of standards on which JavaScript is based. Essentially, EcmaScript and JavaScript are the same thing.

Ecma International is a standards organization that was formed all the way back in 1961 to create standards for information and communication systems. They acquired their name in 1994 from European Computer Manufacturers Association (ECMA) but since then have dropped the acronym and are now simply called Ecma. The name change was intended to address the organization's worldwide scope. Though not the original creators of JavaScript, they are the people essentially responsible for the JavaScript we all know and use today. If you want to know more about what Ecma does you can visit the ECMA website.

Bigger .. Badder .. Better

Ecma creates all of their standards by committee, which we all know can be a very slow and tedious process, especially in the IT world. So, you can probably understand that the most recent standards developed by Ecma have been a long time coming. Much of the current JavaScript on the web today is based on the EcmaScript 3 standards that were released in 1999. So, in technology terms, it has been an eternity since the last major overhaul of JavaScript.

The majority of the effort for improvements this time around focused on making the script more robust and object- oriented so that JavaScript could handle the broader demands of today's Internet. To achieve this EcmaScript 5 has added the ability to create and "protect" objects, improved the error handling process and created a clever way to integrate new JavaScript with old JavaScript. There was also a concerted effort to fix many of the quirks and bugs that existed in previous versions.

An Unwanted Legacy

The biggest problem that Ecma faced was how to expand EcmaScript without breaking existing JavaScript already in use all over the web. Ideally, a complete overhaul would have been much easier had they been able to scrap everything and start from scratch. However, with the Internet now having well over 1 trillion pages, many of which use some form of JavaScript, Ecma had to come up with some way to keep all versions of JavaScript running.

Strictly speaking

To achieve this goal Ecma came up with a simple yet clever solution called, strict mode. The concept is simple, the strict mode would let the compiler know that the code you designate is to be compiled using EcmaScript 5. If strict mode is not indicated, as it would be with all of the JavaScript out there today, the code would be compiled using the EcmaScript 3 standards. In older browsers the strict mode indicator would be basically ignored by the JavaScript compiler as a useless literal at the beginning of your script block or function. Strict mode also allows you to mix your existing scripts with new scripts that you want to run in strict mode. An example of how strict mode is used would be:

  <script>
  "use strict";
  // Your script
  </script>

If you want to indicate a single function to run in strict mode within your script block it would look something like this:

  <script>
  // Your non-strict script
  function newstuff() {
  "use strict";
  // Your new strict script
  }
  </script>

A Work in Progress

Even though Ecma made great strides in fixing and improving EcmaScript, there still is much more they are looking to accomplish. For example, they have taken steps to make objects "tamper proof" by adding the freeze API that basically "locks" the object not allowing it to be manipulated outside its defined scope. However, this API currently only addresses 2 of the three ways that an object can be manipulated.

Who's got the goods?

Currently Mozilla and Microsoft are making the most progress in implementing EcmaScript 5 into their browsers. Most other browsers, except for Apple's Safari, are also making some effort to incorporate the new standards. Now, this doesn't mean that you will likely start dumping all the JavaScript that you have already created and start using the new JavaScript today. In reality we will likely be dealing with "old" JavaScript for the foreseeable future as new browsers adopt the new and improved JavaScript and older browsers naturally phase out. This means that you will have to deal with scripting for newer and older browsers until the EcmaScript 5 standards are more universally adopted.

Conclusion

While there is no doubt that the new JavaScript is a huge step in the right direction, it will not have an instant impact on our web development lives. It will take time to learn all of the new APIs and syntax. It will also take time for the EcmaScript 5 standards to be implemented and universally accepted throughout the web. So, don't drop everything and run out to the bookstore to find your new JavaScript book today. You've got some time to learn it and play with it. If you want to learn more now, though, you can always browse the EcmaScript 5 Standards document. Careful, it's not exactly light reading. Happy scripting!



Up to => Home / Authoring / Tutorials / JavaScript



Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers