Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
tcqag
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
tcqag
12y ago
Just fyi indexOf is O(n), which means if you tried to do: var count = 1000000; var arr = foo(count); for (var i = 0; i < count; i++) arr[i](); It will take O(n^2) and will probably never complete whereas all the other solu
2.
▲
by
tcqag
12y ago
Here's a solution using closure: http://codepen.io/anon/pen/KwmQam