[Javascript] semicolon insertion paranoia
Steve Clay
sclay at ufl.edu
Thu May 18 20:01:54 CDT 2006
I know that it's poor practice to rely on automatic semicolon insertion at
the end of lines, but I'm sometimes paranoid that, when I just want to use
whitespace liberally, some JS engine out there is going to automatically
insert a semicolon that breaks my statement.
Consider:
function invert(given) {
return given
? false
: true;
}
If "return given" was converted to "return given;", a syntax error would
occur on the next line, or the function would completely change..
Do I need to worry about stuff like this? Would JS engines parse the
following function /faster/?
function invert(given) {
return given ?
false
: true;
}
Steve
--
http://mrclay.org/
More information about the Javascript
mailing list