Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It’s interesting in this example that the docs try to show that a for loop is useful, when there’s already an idiomatic approach here:

``` const result = items.map( i => i.length ? i.toUpperCase() : ‘<empty>’) ```

I think things get interesting here when different kinds of iterators come into play (eg generators, async-await for loops, non-array iterables). Shame the landing page doesn’t touch on that at all.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: