This is the example that prompted the tweet. #1 is way more readable to me, do others agree? All the usage I've seen has been similar in readability to this.pic.twitter.com/OVEfJCHQyI
You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more
This is the example that prompted the tweet. #1 is way more readable to me, do others agree? All the usage I've seen has been similar in readability to this.pic.twitter.com/OVEfJCHQyI
Since everyone seems to have a lot of free time to argue with me on the 4th of July. I also heavily dislike the use of unary ! for boolean negation. eg. !true. I've started writing `=== false`.
1. Is that a question of familiarity, or is there some objective reason that one is more readable than the other?
More important is the functional benefit of a loop--in this case it returns after it finds one match.
You can do the same with a function that contains a loop with returns, see my later tweet.
Pet peeve with reduce: returning objects on every iteration. I feel guilty because I often encourage immutability but I haven’t stressed enough that *local* mutations are much clearer to read
I am not saying you’re doing this, but sometimes people mix up “readable” with “familiar”. I used to think loops were easier. Then both seemed equally reasonable to me. Now I think the functional style is easier to understand.
And I’d like to explain why the functional style is easier to understand. It’s because there isn’t a lot of state all over the place that you have to keep around. Your eyes aren’t moving up and down the screen looking for variables and fields all over the place just to grok it
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.