I have a javascript array and a variable. I want to push onto the array an object with the variable as the property name, but it must hold the value of the variable, not the variable as a string. If I have this code:
array = [];
var x = 10;
array.push({x: y});
The x is stored as a string "x", not a variable that contains the value of var x. Any help is appreciated.