Fork me on GitHub

JSLint Error Explanations

JSLint will hurt your feelings. It's time to make them better!


Duplicate key '{a}'

When do I get this error?

JSHint (version 1.0.0 and above) will throw the "Duplicate key '{a}'" error when it encounters an object literal that contains more than one property with the same identifier. In the following example we attempt to assign an object containing two properties with the identifier y to a variable x:

This is the equivalent of the older JSHint "Duplicate member '{a}'" warning. More detail can be found on the page for that message.

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 W075. This means you can tell JSHint to not issue this warning with the /*jshint -W075 */ directive.


comments powered by Disqus