Re: Unexpected " error when concatenating empty string
- --- In email@example.com, "paulb777" <paulb777@...> wrote:
> Error:JSLint doesn't like to see '' as an operand to +, nor does it like to see 0 as an operand to +. If baz is a string, then
> Problem at line 3 character 13: Unexpected ''.
> var bar = "" + baz;
> Is this a jslint regression or new feature. If a feature, what is the rationale?
var bar = baz;
is smaller, faster, clearer. If baz is not a string, then
var bar = String(baz);
is certainly less mysterious.