Hello I am getting this error in IE when i load any js file what should I do?
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET CLR 1.1.4322)
Timestamp: Tue, 1 Mar 2011 18:34:03 UTC
Message: Expected identifier
Line: 26
Char: 21
Code: 0
URI: http://localhost/learning/public/js/general.js
Message: Object expected
Line: 5
Char: 3
Code: 0
URI: http://localhost/learning/public/js/tests.js
I'm willing to wager the cause is an extra comma at the end of an Object Declaration:
var valid = {
'key': 'Value'
};
var invalid = {
'key': 'Value',
};
Google Chrome / Firefox and I believe Safari are intelligent enough to ignore the extra comma. Internet Explorer sees the comma and expects another property to be assigned to the Object.
It is likely either as @g.d.d.c says, a problem with a trailing comma, or the error comes from using reserved key words. When Explorer sees variable names like super
, class
and exports
it will strip those away before evaluating the code.
class = 'asdf';
… becomes …
= 'asdf';
And thus there is no identifier to assign the 'asdf'
string to.