I was under the impression that curly brackets were not needed for one-line "if" statements, and I've long done things this way. The ECMA specs (pp 71-72) shows it in the format that I used if ( Expression ) Statement else Statement, and I've never had any problems until I used this validator (which comes recommended).
Do you have to put them in, no. Should you, probably yes. In nearly all cases, it is better to put them in all the time, even though it is not necessary. Validators like that will always recommend that you do, and so do I. It is only two bytes, and saves confusion down the line.
Great wit and madness are near allied, and fine a line their bounds divide.
It's not that I don't like using the bytes. I just like to keep my code as clean as possible, and I normally like to give the brackets their own lines to I can more easily find what's inside them. In cases like this, it becomes overkill.
Ok, thanks you two. I definitely appreciate it. It's funny how you learn a style from people and then find out it's not correct when you get into serious applications!
well, for java or php, the syntax conventions are different.