Javascript error in IE6/7, no complains in Firefox though

Expected identifier, string or number
Object expected

These errors may occur when browsing a JavaScript enabled website using IE (6 or 7, it doesn’t matter). Where Firefox is happily rendering the page, IE will complain, and generally these two come in tandem, because the script has defined a list or group of functions, and the writer has blithely forgotten that you can’t include a comma at the end of the list; e.g.

var list = { some-value: 0.5, some-value-2: 0.5, }

That innocuous comma at the end results in two errors, because the last comma is a syntax error, and later, when using list you’ll find that is undefined. Perfect. Any decent parser should be able to ignore the bloody comma!

From cow.neondragon.net.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s