This page has been converted from a dynamic Wordpress article to a static HTML document. As a result, some content may missing or not rendered correctly.

"Expected identifier, string or number" ~ Thu, 08 Dec 2011 19:03:14 +0000

Thanks, IE.

I just spent pretty much all day tracking down the cause of this error. Conventional wisdom regarding this error is that you have a snippet of JavaScript like (where the comma trailing "42" is the error):

var myObj = {
    a: "a string",
    b: 42,

I didn't. But IE 8 was still throwing up this error message and its developer tools were pointing me at a line of HTML that contained nothing more than "<div>". WTF, right? So after much confusion, and narrowing of code, I found the line IE was really barfing on. Consider the following object:

var myObj = {
    default: "ie blows",
    b: 42

Can you guess the problem? IE does not like keywords being used as the name of an object property. If you really want to use a keyword, like the jQuery plugin I'm using does, then write your object with JSON style syntax:

var myObj = {
    "default": "ie blows",
    "b": 42
Code,  JavaScript,  Technology