|
|
|
|
|
by feupan
1596 days ago
|
|
Sorry but bad article. It resolves with a “range()” function and then uses for-of to call it: that’s not functional programming. Then every for-of loop example does not execute anything because it’s creating an inline arrow function without calling it. |
|
>Off-by-one bugs are more probable. For example, you might write i<22 instead, and then the loop would end at 21, not 22.
Ironically, their implementation of a function called "range" differs from the (likely) best known function by that name (that of Python), causing exactly this problem. (Also, the Pythonic range is probably a better fit for a language with 0-based indexing.)