2
inaba
20d

One of my least favourite parts of the world of programming is the "there's a usecase for everything" attitude. Like take this part of "You don't know Javascript" https://github.com/getify/...

> But var is still useful in that it communicates "this variable will be seen by a wider scope". Both declaration forms can be appropriate in any given part of a program, depending on the circumstances.

Now you would imagine that after this comment the author added a good example of this or at least had a reference to another part of the book where it showed this, but nope it goes on to include this note:

> It's very common to suggest that var should be avoided in favor of let (or const!), generally because of perceived confusion over how the scoping behavior of var has worked since the beginning of JS. I believe this to be overly restrictive advice and ultimately unhelpful. It's assuming you are unable to learn and use a feature properly in combination with other features. I believe you can and should learn any features available, and use them where appropriate!

Which again, "durr there's a usecase for this feature" or rather it's coming with basically an insult towards people who don't think you should use var without actually addressing anything. And what usually happens when someone tries to "there's a usecase for everything" is to either be really vague, or come up with some silly thing that you "might" do.

Comments
Add Comment