3 ms·
Because let transformed = for(let i=0; i<n; ++i){something()}; doesn't work. For loops are just clunky. They're not values, you can't pass them around or cop
by still_grokking 6y ago
Because
let transformed = for(let i=0; i<n; ++i){something()};
doesn't work.
For loops are just clunky. They're not values, you can't pass them around or copy'n'paste them where the transformed value is needed.
- eins1234 6y agoThis. Data and transformations on data (map, filter, reduce, etc) are trivially composable. Imperative loops are not (unless you abstract them away behind a function that accepts and returns data, in which case you'd be re-implementing map, filter, reduce with imperative loops).