3 ms·
Javascript is a functional language. You _should_ be writing many functions, possibly thousands in a large codebase.
by adrianpike 11y ago
Javascript 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).