Using ES6 Classes

Visit http://weblogs.asp.net/dwahlin/getting-started-with-es6-using-classes for more details.

Babel + JSX

const main = async () => {
  let loop = function(iter) {
      n = 0;
      x = 0;
      while (n < iter * 10000000) {
          n++;
          x += n;
      }
      return n + 1;
  }

  async function getSomeText(text, time) {
      n = await loop(time);
      return `value - ${text} was showed with delay ${time} and while is ${n}`;
  }

  async function showText(sometext, time) {
      sometext = await getSomeText(sometext, time);
      console.log(sometext);
  }

  await showText("something that works in async way", 4);

  await showText("something that works in async way", 2);

  console.log('something that work in main thread');
}

main();