by thisisblurry on 12/11/12, 2:36 AM with 12 comments
by modeless on 12/11/12, 3:25 AM
by Stratoscope on 12/11/12, 4:21 AM
As isaacs points out, the first part of the article about "else if" is much ado about very little. And why the sideways hint that there is something wrong with "else if"?
The second part is lazy and inconsistent refactoring. Why go through the exercise of removing the <= 100 test and never notice that there's also a redundant <= 10 test in all three examples?
If you know JavaScript at all, this article is a waste of your time.
by emef on 12/11/12, 3:16 AM
by carstimon on 12/11/12, 3:03 AM
For example, if the insides of the if statements were a touch more complicated, the third could also fit the pattern of a recursive function with two base cases. We would have to read more to figure out the idea.
The first is preferable to the second because I immediately see that only one thing will happen, I don't need to look inside the if's. (Relevant if the inside is more complicated).