1const object1 = {
2 a: 'somestring',
3 b: 42,
4 c: false
5};
6
7console.log(Object.keys(object1));
8// expected output: Array ["a", "b", "c"]
1var myObj = {no:'u',my:'sql'}
2var keys = Object.keys(myObj);//returnes the array ['no','my'];
1var fighters = new WeakMap();
2var bruce = {name: 'Bruce Lee'};
3var chuck = {name: 'Chuck Norris'};
4
5fighters.set(bruce, 'Jeet Kune Do');
6fighters.set(chuck, 'Karate');
7
8console.log(fighters.get(bruce)); // Jeet Kune Do
9console.log(fighters.get(chuck)); // Karate
1var key = "happyCount";
2var obj = {};
3obj[key] = someValueArray;
4myArray.push(obj);
5