joedborg
joedborg

Reputation: 18353

Javascript can't create dictionary in IE

var Dictionary = {
foo: "bar"
}

alert(Dictionary.foo)

This works fine in Firefox 6, but not in IE8, is there a syntax error that FF is displacing, or do I need an IE fix?

Upvotes: 0

Views: 251

Answers (1)

Neq
Neq

Reputation: 66

This example does work in IE8 - at least for me. I'm running on a Windows XP SP 3 with the latest IE8.

If you have problems with some Object-notations, check if your key is named like keywords which are specified in JavaScript, like class and aren't defined as a String (you need to write it as "class". Otherwise missing colons are often a source of errors.

Upvotes: 1

Related Questions