Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
60
rated 0 times [  62] [ 2]  / answers: 1 / hits: 31024  / 14 Years ago, mon, june 14, 2010, 12:00:00

I know that some people consider the presence of a leading underscore to imply that a variable is private, that such privacy is a fiction, and assume this is why JSLint reports such names with an error message.



I use Google Analytics on a Web site I am building. I make reference to GA's variables, such as _gaq.



I am trying to get my JS code to be 100% JSLint clean (I'm not religious about my coding style, and so will go with Mr. Crockford's counsel). That said, I can't do anything about Google's variables names... so, I guess I can't get 100% clean.



I post here in case I've misunderstood the message, and can do something to comply with JSLint practices.


More From » jslint

 Answers
72

Ah, I've got this handled... I wrap the statements that use the underscore prefixed variables with JSLint commands to disable, then re-enable this class of error:



/*jslint nomen: true*/
... statement(s) with _var ...
/*jslint nomen: false*/

[#96498] Friday, June 11, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
myrap

Total Points: 407
Total Questions: 105
Total Answers: 109

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
myrap questions
Tue, Feb 8, 22, 00:00, 2 Years ago
Wed, Jan 15, 20, 00:00, 4 Years ago
Thu, Oct 24, 19, 00:00, 5 Years ago
Thu, Oct 3, 19, 00:00, 5 Years ago
Mon, Aug 12, 19, 00:00, 5 Years ago
;