Or you can wrap the whole thing in parens: var someFunction = function () { 'use strict'; }; (someFunction() (someFunction) (someFunction) (someFunction) ...
2787
spence.randall@...
spence.randa...
Feb 14, 2012 7:03 pm
Given the following code: var obj = {}, ````test = function () { ````````'use strict'; ````````return true; ````}.bind(obj); JSLint returns the following...
2788
John Hawkinson
john.hawkinson
Feb 14, 2012 7:12 pm
JSLint wants you wrap your function expression in parentheses. I think it's probably right, multiword expressions are confusing to read, and parens remove the...
2789
douglascrockford
douglascrock...
Feb 14, 2012 7:27 pm
... Thanks. Please try it now....
2790
spence.randall@...
spence.randa...
Feb 14, 2012 8:11 pm
Works as expected, thanks for the fast turnaround. -Randall...
2791
junkernaught
Feb 17, 2012 10:11 pm
This code gives me an error, I'm not sure why: function charAt(sValue, index) { return sValue.charAt(index) - '0'; } Message: Problem at line 2 character 25:...
2792
douglascrockford
douglascrock...
Feb 17, 2012 10:29 pm
... That warning wasn't very helpful. Please try it now....
2793
junkernaught
Feb 17, 2012 11:08 pm
OK, the new warning makes more sense. Thank you!...
2794
Jordan Harband
ljharb
Feb 18, 2012 2:48 am
The error does still occur if you do choose to wrap your function in parens. ... [Non-text portions of this message have been removed]...
2795
douglascrockford
douglascrock...
Feb 18, 2012 1:46 pm
... That is because you shouldn't do that....
2796
Jordan Harband
ljharb
Feb 19, 2012 9:02 pm
Why do you recommend wrapping an immediate function invocation in parens, but not an immediate invocation of a function call on a prototype method of an...
2797
Phil
druid_rpg
Feb 21, 2012 5:55 am
Tolerate uncapitalized constructors checkbox and the associated newcap flag does not seem to be working. I get ... "should start with an uppercase letter."...
2798
Doc Emmett Splendid
emmett.thesane
Feb 21, 2012 6:06 am
Could you please give us the code sample which fails? The following works for me when the "Tolerate uncapitalized constructors" checkbox is checked: var foo =...
2799
Phil
druid_rpg
Feb 21, 2012 7:19 am
hmmmm, that's strange. Its working now, and I can not reproduce by going back to the original version of the code that failed. Must have been something weird...
2800
benxwhite
Feb 23, 2012 4:21 pm
It would be nice if the following predefined globals could be added to the 'browser39; array self top XDomainRequest and these to the 'standard39; array void ...
2801
douglascrockford
douglascrock...
Feb 23, 2012 5:51 pm
... self is redundant. top is dangerous. I will not be exposing that by default. XDomainRequest is not standard. void is confusing. escape/unescape have been...
2802
benxwhite
Feb 23, 2012 6:27 pm
This is a pretty common bit of code that I would expect to pass validation. if (self !== top) { top.location = self.location; } Additionally, if you fee so...
2803
Brennan
gurunannerb
Feb 24, 2012 2:44 pm
I'm afraid that I don't accept "that39;s the way it's always been" or variants as a strong argument. Especially when exceptions can be so readily found. But OK,...
2804
Joshua Bell
inexorabletash
Feb 24, 2012 5:11 pm
... in Workers. When writing code that may execute in either Window or Worker context, it's nice to use |self| consistently. Alternately, you can use this...
2805
Tom Worster
thefsb
Feb 24, 2012 5:37 pm
... this leads to a need for a standard resembles($char1, $char2) function. but resemblance is subjective. the ICU SpoofChecker?...
2806
firstbakingbook
Feb 28, 2012 4:53 pm
I expect this is a common question, but searching for "this" isn't getting me anywhere. "use strict"; function foo() { var a = this; } var bar = function() { ...
2807
douglascrockford
douglascrock...
Feb 28, 2012 5:17 pm
... The this psuedoparameter is bound to undefined (not the global object) when a function is called in the function form in strict mode. JSLint must do its...
2808
Kirk Cerny
kirk.cerny
Feb 28, 2012 6:30 pm
Thanks for supporting JsLint. I really enjoy using it. Is this a new rule? I get this error now. Can someone please explain the reason behind the rule? Error: ...
2809
Doc Emmett Splendid
emmett.thesane
Feb 28, 2012 6:48 pm
Using multiple returns is equivalent to a goto. It's best to collect your tests and pass the result in a single return. ________________________________ From:...
2810
douglascrockford
douglascrock...
Feb 28, 2012 7:14 pm
... Please see http://llvm.org/docs/CodingStandards.html#hl_else_after_return...
2811
Mark Volkmann
mark_volkmann
Feb 28, 2012 7:36 pm
In case it's not obvious, you can just do this: return num === 1; ... R. Mark Volkmann Object Computing, Inc. On Feb 28, 2012, at 12:30 PM, Kirk Cerny...
2812
Erik Eckhardt
vorpalmage
Feb 28, 2012 7:56 pm
Down with "goto" Naziism! I mean, seriously. Go to a particular end point buried in the middle of code? Yes, that should be verboten. But many, many...
2813
spence.randall@...
spence.randa...
Feb 28, 2012 8:11 pm
Just in case this was an overly simplified function to illustrate the error message, another solution would be to simply remove the unnecessary 'else': var...
2814
Erik Eckhardt
vorpalmage
Feb 29, 2012 12:37 am
Douglas, You may not wish to use llvm.org as a resource for coding standards, as the same page suggests the use of early ...