Monday, 22 August 2016

Write Future’s Javascript NOW!


What is Javascript?

JavaScript (JS) is a lightweight, interpreted, programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as node.js and Apache CouchDB. JS is a prototype-based, multi-paradigm, dynamic scripting language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.

Some of the available Javascript Implementations:

The first ever JavaScript was created by Brendan Eich at Netscape, and has since been updated to conform to ECMA-262 Edition 5 and later versions. This engine, code named SpiderMonkey, is implemented in C/C++. The Rhino engine, created primarily by Norris Boyd (also at Netscape) is a JavaScript implementation written in Java. Like SpiderMonkey, Rhino is ECMA-262 Edition 5 compliant.
Several major runtime optimizations such as TraceMonkey (Firefox 3.5), JägerMonkey (Firefox 4) and IonMonkey were added to the SpiderMonkey JavaScript engine over time. Work is always ongoing to improve JavaScript execution performance.
Besides the above implementations, there are other popular JavaScript engines such as:-
  • Google's V8, which is used in the Google Chrome browser and recent versions of Opera browser. This is also the engine used by Node.js.
  • The JavaScriptCore (SquirrelFish/Nitro) used in some WebKit browsers such as Apple Safari.
  • Carakan in old versions of Opera.
  • The Chakra engine used in Internet Explorer (although the language it implements is formally called "JScript" in order to avoid trademark issues).

Can we use it is NOW?

The final ECMAScript 6 standard (ECMA-262) was published in June 2015 after resolving some its nasty aspects. As programming never is just about getting the necessary functionality done, it is advised to also use the best language, too. ECMAScript 6's language design is cleaner than ECMAScript 5, its syntax increases the expressiveness of your code, it decreases the necessary boilerplate code (e.g. function vs. arrow syntax) and it especially let you get rid of some very nasty but required hacks and workarounds from the ECMAScript 5 era (e.g. var self = this).
But the major issue in using ECMA Script 6 is the lack of support by major browsers. 

How to use Futures Javascript NOW?

The solution to use the future standards of Javascript in your current browsers is Transpilers, or source-to-source compilers.
The most popular transpilers are;
1) TypeScript (https://www.typescriptlang.org/)
2) Babel (https://babeljs.io/)
3) Traceur (https://github.com/google/traceur-compiler)
Also Type chekers like flow (https://flowtype.org/) is adding value to your future’s code

No comments:

Post a Comment