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.

Elements of JavaScript Style

6 pointsby ericelliottabout 8 years ago

2 comments

uwuabout 8 years ago
i find the longer versions of the first two examples in &quot;2. Omit needless code&quot; more readable<p>i think my mental parsing at a glance of the short version of the first example trips over how there are no parentheses around the &quot;msg&quot; parameter and it looks like an ordinary variable until i reach the &quot;=&gt;&quot; after it<p>and in the second example, parentheses (expression body) are used instead of braces (block body) but with indentation that&#x27;s typical for block bodies so you can&#x27;t easily tell it&#x27;s an expression body at a glance (also depends on how well your font differentiates &quot;{&quot; and &quot;(&quot;)<p>&gt; Sometimes we’re tempted to assign names to things that don’t really need to be named. The problem is that the human brain has a limited number of resources [...]<p>i don&#x27;t think intermediate variables are all that bad, especially for things that&#x27;d make an expression too long to comfortably fit on a line<p>or is it something only functional programmers care about<p>i&#x27;m not a fan of the currying and point-free and other things and find them pretty unreadable but i never did that kind of functional programming (to my knowledge) so i am not legally allowed to have an opinion on them
评论 #14271063 未加载
vertebrateabout 8 years ago
cargo-culting haskell
评论 #14271085 未加载