JSLint (prior to July 2013) and JSHint will throw the "A leading decimal point can be confused with a dot: '{a}'" error when they encounter a numeric literal preceded by a . character which itself is not preceded by a decimal integer literal. Here's an example in which we attempt to assign the value 0.5 to the variable x:
This error is raised to highlight a potentially confusing piece of code. Your code will run without error if you do not address this issue but it could be confusing to other developers.
The ECMAScript standard states that it is syntactically valid for a numeric literal to begin with a . character (ES5 Annex 1):
DecimalLiteral ::
DecimalIntegerLiteral . DecimalDigitsopt ExponentPartopt
. DecimalDigits ExponentPartopt
DecimalIntegerLiteral ExponentPartopt
The second production in the grammar quoted above shows the situation we encounter in the example at the top of this page. However, since the . character is ambiguous (it's also commonly seen in use as a "member operator", to access a property of an object), JSLint and JSHint prefer the explicit first production from the above grammar, just to make your code easier to understand.
To fix this error, simply prepend a 0 to your number:
In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W008. This means you can tell JSHint to not issue this warning with the /*jshint -W008 */
directive.