4 ms·
I do not like inconsistency. I never leave out curly braces. I never omit semi-colons. There is no reason to do so. I dislike working on code written by peopl
by code_duck 16y ago
I do not like inconsistency. I never leave out curly braces. I never omit semi-colons. There is no reason to do so.
I dislike working on code written by people who feel the need to omit these symbols. I would prefer if JavaScript would, like PHP or C, require semicolons at the end of every statement.
- parkan 16y agoBe very, very careful when you're using PHP as an example of the proper way to do something, because you're probably at least partially wrong. Semicolons are optional when followed by a closing tag (and likewise, closing tags are optional when the last statement ends with a semicolon -- in this case, whitespace at the end of the file is valid, as well)
- code_duck 16y agoYes. There is one situation in which you may omit a semicolon in PHP. This does not create a situation like the semicolon insertion in JavaScript, however, and I don't perceive as an ambiguity or inconsistency issue. Are you saying this detail about PHP causes problems of some sort? I can't think of any. If JavaScript were to work like that, and only let you omit a semicolon before a closing script tag, that would be absolutely fine with me.