TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Master the JavaScript Interview: What Is Function Composition?

6 pointsby ericelliottover 8 years ago

1 comment

eyelidlessnessover 8 years ago
One of the nice things about making composition easily available and accessible (if not a first class part of your language&#x27;s syntax or standard library) is that developers will naturally tend to break their functions up into smaller, reusable, composable parts.<p>And despite the fact that functions like `comp`, `map`, `reduce` and functions as values tend to be the takeaway of &quot;functional programming&quot; when glommed onto imperative languages—despite the fact that they are tools, rather than the essence, of FP—when they&#x27;re easy to grab and use, developers do tend to write more pure and more easily maintained code.<p>There&#x27;s stuff I don&#x27;t like about underscore&#x2F;lodash type libraries (most notably they put the `data` argument in the wrong place, which harms comparability!), but their prevalence absolutely encourages better practices in less hospitable languages like JS.
评论 #12440005 未加载