Why 'Unexpected “.”' when using || operator for a default value in parenthesis
问题 Getting Unexpected "." from jslint ( http://jslint.com/ ) on this code: function test(foo) { "use strict"; return (foo || "").replace("bar", "baz"); } Why does jslint have a problem with the || operator to force an empty string so a replace can be performed without causing an error, in case foo is passed in as undefined? This passes: function test(foo) { "use strict"; var xFoo = (foo || ""); return xFoo.replace("bar", "baz"); } I know it's opinion based and I can ignore it, etc... but trying