javascript object as key code example
Example 1: object keys javascript
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.keys(object1));
Example 2: js object keys
var myObj = {no:'u',my:'sql'}
var keys = Object.keys(myObj);
Example 3: javascript object as key
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));
console.log(fighters.get(chuck));
Example 4: javascript variable as object key
var key = "happyCount";
var obj = {};
obj[key] = someValueArray;
myArray.push(obj);