Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

what's the js equivalent to your example?

   let code = () => {
     let count = 0;
     return ++count 
   }
doesn't do the trick


JS doesn't have the do {} expression form so

  let code;
  {
    let count = 0;
    code = () => ++count;
  }
or let-over-lambda it and

  let code = (() => {
    let count = 0;
    return () => ++count;
  })();




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

Search: