let yourKeyVariable = "Fire";
{
[yourKeyVariable]: someValue,
}
/* object will resolve to { Fire : someValue } */
/*
This is similar to adding k-v pair to an object using the other syntax
ie. object[yourKeyVariable] = someValue;
*/
var key = "happyCount";
var obj = {};
obj[key] = someValueArray;
myArray.push(obj);
var key = "happyCount";
var obj = {};
obj[key] = someValueArray;
myArray.push(obj);
var fighters = new WeakMap();
var bruce = {name: 'Bruce Lee'};
var chuck = {name: 'Chuck Norris'};
fighters.set(bruce, 'Jeet Kune Do');
fighters.set(chuck, 'Karate');
console.log(fighters.get(bruce)); // Jeet Kune Do
console.log(fighters.get(chuck)); // Karate