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

Why not to write it in a much simplier way? Like this:

  function bar(n) {
    // still has dependency on q, r, s
  }
  foo(..., bar);



Yeah, that's nicer if bar() can be defined at the same "level" as foo() but if it makes more sense to move it somewhere else the closed-over variables need to be passed.




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

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

Search: