3 ms·
The example calls indexOf instead of calling a loop directly and indexOf uses a loop under the hood. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re
by patrickhogan1 7y ago
The example calls indexOf instead of calling a loop directly and indexOf uses a loop under the hood.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- jplayer01 7y agoIs the goal to remove all for loops at all levels of code or to abstract them away to some benefit?
- chaosite 7y agoI don't know! The goal seems to be to restrict yourself for the sake of restricting yourself, as a way to induce creativity. So, hiding the for-loop away in a library function does seem like cheating...