4 ms·
Yes, but if you write a few thousand of those arrow functions, you will hate the useless function (a) { return b; } stuff, too.
by kuschku 11y ago
Yes, but if you write a few thousand of those arrow functions, you will hate the useless function (a) { return b; } stuff, too.
- eueueu 11y agoIf you're writing a few thousand functions, you're doing something very wrong. It's like when languages make threads easy to create - and then programmers go away and use threads for everything! Maybe some verbosity is a good thing because it makes programmers think about whether they really want to do something a few thousand times.
- adrianpike 11y agoJavascript is a functional language. You _should_ be writing many functions, possibly thousands in a large codebase.
- pekk 11y agoJavascript has first-class functions and anonymous functions, but so do lots of imperative languages, and there are plenty of other reasons to see Javascript as an imperative language. The reason we end up writing many anonymous functions is because we are using interfaces like foo.map(...) instead of interfaces like for-loops which take a block as a body (because Javascript for-loops are unbearably clumsy, e.g. iterating over properties instead of elements).