rc3.org Rafe Colburn on software development (and other topics)

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.


2 Comments

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…

Posted by daveadams on 27 May 2009 @ 8pm

Whitespace is good.

Posted by John on 27 May 2009 @ 9pm

Leave a Comment