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

To be fair; getting the benefit of const would require code too though:

  function constUseful () {
    var guarded = 1;

    (function loop (orgGuarded) {
      setTimeout(function () {
        if (guarded !== orgGuarded) {
          throw 'guarded reassigned!';
        }
        loop(orgGuarded);
      }, 0);
    })(guarded);

    guarded = 2;
  }

  constUseful();
That's an approximation of const's value as delineated in code.



Consider applying for YC's W25 batch! Applications are open till Nov 12.

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

Search: