1//You need to make the object first, then use [] to set it.
2
3var key = "happyCount";
4var obj = {};
5obj[key] = someValueArray;
6myArray.push(obj);
1var final = [{
2 id: 23477234
3}];
4
5
6//add new object to the array using variables as keys AND values
7var newArrray = {};
8var key = "name";
9var value = "John";
10newArrray[key] = value;
11final.push(newArrray);
12
13/*
14final now equals
15
16[{
17 id: 23477234,
18 name: "John"
19}]
20
21*/