On 12/26/2014 07:24 AM, Wesley Hardman wrote: > s = "Some text"; > console.log(s); > > With javascript.options.strict set to true, it outputs "ReferenceError: > assignment to undeclared variable s". Are there any advantages to actually > fixing it? The code obviously works just fine either way.
It's trivial to put a var in front of this. Declaring global variables may make code run faster. In this super-limited example, maybe not. But teaching when it's faster and when it's not is far less easy than a simple blanket rule to "create global variables using declarations". In general that's how most of the extra-warnings warnings work -- don't do it this way, because this way can be bad, although we're not going to conclusively say it's not bad in this exact instance because that requires expert human confirmation. Jeff _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform