I have code like this (that cancel ajax calls):
if (requests.length) {
for (i=requests.length; i--;) {
var r = requests[i];
if (4 !== r.readyState) {
try {
r.abort();
} catch(e) {
self.error('error in aborting ajax');
}
}
}
requests = [];
// only resume if there are ajax calls
self.resume();
}
and jshint show error:
Value of 'e' may be overwritten in IE 8 and earlier.
in } catch(e) {
what that error mean?
The "Value of '{a}' may be overwritten in IE8 and earlier" error is thrown when JSHint or ESLint encounters a try...catch statement in which the catch identifier is the same as a variable or function identifer.
The error is only raised when the identifer in question is declared in the same scope as the catch.
In the following example we declare a variable, a, and then use a as the identifier in the catch block:
var a = 1;
try {
b();
} catch (a) {}
To resolve this issue simply ensure your exception parameter has an identifier unique to its scope:
var a = 1;
try {
b();
} catch (e) {}
http://linterrors.com/js/value-of-a-may-be-overwritten-in-ie8
I found the error it's event handler that have e as event. And this should throw an error https://github.com/jshint/jshint/issues/618
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