I'm reformatting a plug-in so that it passes JSLint. Plug-in uses trailing underscores to name local variables, like so:
var __slice = [].slice,
__indexOf = [].indexOf
JSLint does not like this. What's another easily recognisable convention for naming these, that JSLint won't object to?
Quoting from Douglas Crockford, the guy who invented JSLint:
Do not use _ (underbar) as the first character of a name. It is sometimes used to indicate privacy, but it does not actually provide privacy. If privacy is important, use the forms that provide private members. Avoid conventions that demonstrate a lack of competence.
Most variables and functions should start with a lower case letter.
Taken from Code Conventions for the JavaScript Programming Language .
You can look at Private Members in Javascript to see what he meant by use the forms that provide private members.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With