Better HN
topnewbestaskshowjobs
Log inSign up

jcrowe206

2 karma · joined Jan 20, 2015 (11y ago) · 2 submissions

Submissions

comment 11y ago · link · parent

fourth solution would be naming the function with the iterator (as in my example below) and calling indexOf(iterator) when the function is invoked

comment 11y ago · link · parent

Here's another one. Probably not very performant

  function foo(count) {
     var ret = []
     for (var i=0; i < count; i++) {
        ret [i] = function i() { return this.indexOf(i) }
     }
     return ret;
  }