Fork me on GitHub

JSLint Error Explanations

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


Variables should not be deleted

When do I get this error?

JSHint will throw the "Variables should not be deleted" error when it encounters the delete operator when its operand does not appear to be an object property. In the following example we declare a variable x and then attempt to delete it:

This is the JSHint equivalent of the "Only properties should be deleted" error from JSLint. More detail can be found on the page for the JSLint 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 W051. This means you can tell JSHint to not issue this warning with the /*jshint -W051 */ directive.


comments powered by Disqus