Hacker News new | past | comments | ask | show | jobs | submit login

looks awesome. why only es5 support?



ES5 has a lot of interesting hoisting bugs.

For example this doesn't print what you expect:

  for (var i = 0; i < 3; i++) {
    var text = 'number ' + i;
    setTimeout(function() {
      console.log(text);
    }, i * 1000);
  }
But flipping var to let will fix it. The bug is that var is not block-scoped so everything refers to the same `text` variable which gets mutated by the next iteration.

I was hoping their demo would be good for explaining this bug but it seems to be broken.


This is not a bug, this is spec.

variables in javascript are not block scoped, but functionally scoped.

the let keyword introduces block scope to javascript.


Probably because ES6 syntax adds a lot more possible complications to the syntax tree.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: