Saturday, November 21, 2015

Quo Vadis JavaScript?

JavaScript went through a makeover extraordinaire with ES2015 which was finalized this summer.

This is not your grandma’s JavaScript any more:

import React from 'react';

export default class Catalog extends React.Component {
    buy(product) {
    render() {

But it seems this was just the beginning… the metamorphosis is far from done for JavaScript.

For future versions of JavaScript there are many proposed new language features. Among the most outstanding proposals for me are decorators, async functions and private state

Some years ago nobody would have believed that the following snippets are (will be) valid JavaScript.


export default class CatalogStore {
    onSearchLoaded() {

Async Functions:

async function fetchJson(url) {
    try {
        let request = await fetch(url);
        let text = await request.text();
        return JSON.parse(text);
    catch (error) {
        console.log(`ERROR: ${error.stack}`);

Private State:

class DataObj {
  private #data1;

  constructor(d) {
    #data1 = d; 

  get data() {
    return #data1;

I think its now safe to say that Silverlight and Flex were failed attempts to bring other languages than JavaScript into browsers … but looking at the snippets above, it might sure look like some C#/Java infiltration squad sneaked into the Ecma building …

Babel and TypeScript both already support decorators and Babel also supports async functions (TypeScript is working on it). So you can use those language features right now in a modern JavaScript project setup.

Of course the JavaScript ecosystem/community is going through a tremendous development and learning process right now. We are slowly getting the new features piece by piece and figuring out how to use them … while that slow metamorphosis process can be healthy, it can also be painful…

In the future, once JavaScript has completed it’s metamorphosis, people might legitimately ask why we did not just integrate C# or Java into the browsers … ?

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...