5. WebAssembly – The alternative to JavaScript

WebAssembly is the modern, cool way to write JavaScript scripts by not using JavaScript itself. So you can use the power and libraries of an other language, such as Perl, Ruby or directly C or C++, and compile them into WASM. This WASM Code can get read and parsed by the JavaScript WebAssembly object, which is linked below. This new hip way should be faster then vanilla JS Code, and way more flexible.

I’m not into WebAssembly at all, I never tried something with it, I never saw respective code. This will definitely change it in the future for myself, but I know, that the Internet Explorer will NEVER see WebAssembly for the rest of his – hopefully short – life!

 

4. Class – The alternative to Prototyping

The ECMAScript 2015 (ES6) standard implements (in addition to many other stuff) the new class statement / expression, which allows to create real classes. These classes can also be extended and adding / offering static methods. Many developers see this as “unnamed” successor of the JavsScript known “prototyping”, which offers now also real constructors instead of plain function bodies. It also includes getters and setters and opens a conform, standardized and non-breaking way to “extend” main / core objects!

It is a really awesome new way, to write extensive applications or libraries. And there are already some cool projects out there, and all have and all have at least one thing in common: They are not supported on ANY Browser named Internet Explorer. Thats sad.

 

3. Promise – catch, then, all, finally

I promise, that I would use asynchronous operations using directly the awesome Promise object in my script. However, the Internet Explorer doesn’t seem to allow this!

But wait, what are promises in JavaScript?

Modern JavaScript applications as well as commonJS / nodeJS (which is JavaScript used as Backend environment, instead of PHP or Python) using asynchronous operations to do stuff, and handle functions. We are talking about all kind of stuff: Fetching data, Reading data, Checking data…. like EVERYTHING. So how it works? You request something, show the user a loading circle (or just nothing on secret / backend stuff) and let the result passing your “callback” function when it’s finished. Thats like AJAX (XMLHTTPRequests) and JSONP works too.

It can also be a bit more complex, using the statements within the header, but you get the glue!

 

2. Generators – Yield me, right now

I really love generator functions after my first touch in Python, and was statisfied as PHP 5.5.0 introduced it also. The ECMAScript 2015 (ES 6) standard has also implemented Generators FINALLY into the JavaScript language environment. Again, I would have been really really happy, but I know my friend the Internet Explorer. He doesn’t like cool features, which gets introduces AFTER or DURING his own release.

Generators are functions*, which doesn’t “leave” after returning the value, when using the yield statement (in the most languages I know) of course. So you are able to setup a base environment (lets say a RegExp for a search) and returning values as long you (the Generator) or the Sequence (which uses the generator) wants. In our “search” example this means: The generator returns EACH result to the main function and stops if there are none left, the main function would catchs as many results as available (or stops after the UI is filled enough).

However, I use this feature in some of our projects, offering a specific “NON-IE” ES6 version. The “IE”-supported part gets a unsightly Generator-Like behavior function. It doesn’t looks nice, but it does the job.

 

1. Everything cool, which would simplify your work

The functions and objects above are really cool, but can either be replaced (using a Polyfill) or ignored due to the really special usecase (WebAssembly). So why I’m talking about such features? I can also mention methods like toggle() or add() / replace() of the classList object. Or name something like the object-styled settings in the addEventListener() method, which allows to trigger a method just once or ignores the “preventDefault()” event call. AND I can also talk about the after(), before(), replaceWith() or remove() methods on Element / Node objects (they really exist!).

Everything isn’t or is just partly supported in the complete Internet Explorer family. Everything (or at least the most of them), can be replaced as mentioned above. But that’s not the glue of this article. I’m talking about the loveless, which Microsoft gives HIS OWN BROWSER. It is the default Browser on MILLIONS of computers. Each single Windows User MUST use it, at least to get a better browser. It is one of the most important programs, at least since the Internet is everywhere (starting with the first Smartphones between 2008 – 2009). It should be the precursor of the style and behavior how we enter and using Websites.

And Microsoft just gives a fuck.