Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jcrowe206
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
jcrowe206
12y ago
fourth solution would be naming the function with the iterator (as in my example below) and calling indexOf(iterator) when the function is invoked
2.
▲
by
jcrowe206
12y ago
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; }