Strong opinions, weakly held

Quotable: Douglas Crockford

On why you should never leave out the space between ”if” and the expression that follows in JavaScript: The Good Parts:

I placed a space between ”if” and ”(” so that the ”if” didn’t look like a function invocation.

I’m just quoting this because it’s one of those little things that drives me nuts when people are sloppy about it.


  1. That’s interesting. I’ve never felt that syntax was confusing, even at a glance, especially since the thing in parens after the “if” is almost always a comparison expression. In fact, I think it looks sloppy to have a space, and I always remove it if I happen across it in code other people wrote…

  2. Whitespace is good.

Leave a Reply

Your email address will not be published.


© 2024 rc3.org

Theme by Anders NorenUp ↑