My Blog

contains PHP and other web related content. (Sometimes there are some off topic things - don't freak out!)

IE JS Error: Expected identifier, string or number

I just ran into this a bunch – works fine in FireFox … of course.

Well apparently, Internet Explorer won’t allow you to have a trailing comma in a array or object definition. Let me show you:

?View Code JAVASCRIPT
1
2
3
4
functionCall({
        options: {1,2,3},
        others: {1,2,3},
});

The trailing comma after the other’s line is making IE expect another identifier. So, just strip it out so that line is now:

?View Code JAVASCRIPT
1
        others: {1,2,3}

And you should be golden!

Now, if only IE told me what line the error was on ;)

(For those who need a tip, I loaded up the site in firefox with jsview extension – and went to view all js. Then do ctrl-L to jump to a line – and type in the line number that IE mentions… see if there is something around there that looks like this scenario)

Tags:

Leave a Reply

  • twitter loader

Follow me on twitter: @aaronsaray

The views on this website are my own and do not reflect the opinions of my employer or clients.
Creative Commons License Home | Open Source | Book | Music | Art | Bio | Resume | Contact
My Baby