|
|
|
|
|
by LordN00b
1433 days ago
|
|
To take your argument to the extreme, why have for loops, when then are syntatic sugar over while loops?
I'm generally a fan of syntatic sugar in a language if it's purpose is to simplify what's already there; but it is a balance between developer productivity and ease-of-use.
I once saw javscript described as 'pithy', becuase of it's small syntatical footprint, that's probably not true so much now. |
|
Also, avoiding the for loop in JS might be a good idea because of how easy it is to shoot yourself in the foot with "for (x in stuff) ..." creating a global variable (when you accidentally leave out "var").
[1] Probably this one? https://www.youtube.com/watch?v=XFTOG895C7c