Reputation: 21206
Why does this not work? I get an error that this action is not supported by my IE9.
var data = new { selectedUnitKey: { value1: 1, value2: 2} }
Upvotes: 1
Views: 43
Reputation: 382150
Remove the new
:
var data = { selectedUnitKey: { value1: 1, value2: 2} }
From the MDN :
The new operator creates an instance of a user-defined object type or of one of the built-in object types that has a constructor function.
You use new like this when you define your "class" :
function SomeClass(unitKey) {
this.selectedUnitKey = unitKey;
}
var data = new SomeClass({ value1: 1, value2: 2});
Upvotes: 3