Possible Duplicate:
Using a variable for a Javascript object key
I can't figure out how I am messing this up.
My code gives me the error:
invalid property id
Code:
return { this.Obj.itemid :
{ Color : this.Obj.color,
Name : this.Obj.name,
Year : this.Obj.year
}
};
I need to return these hashes as an array (thus the return), but no matter what I do, it either returns the error above, or the var reference is stringified. I can't actually get the dynamic js value in there as a key.
I've tried this:
" + this.Obj.itemid + "
and this:
var itemid = this.Obj.itemid;
return { itemid : {
//etc..
}}
Any ideas?