get specific keys from object.keys code example

Example 1: get all keys of object in javascript

myObject = {
	"key": "value",
    "key2":"value2"
}
Object.keys(myObject);
//console.log(Object.keys(myObject))   = ["key", "key2"]

Example 2: javascript subset of object array matching certain property

let cities = [
    {name: 'Los Angeles', population: 3792621},
    {name: 'New York', population: 8175133},
    {name: 'Chicago', population: 2695598},
    {name: 'Houston', population: 2099451},
    {name: 'Philadelphia', population: 1526006}
];

let bigCities = cities.filter(function (e) {  // filter function
    return e.population > 3000000;
});

//Output:
[
  { name: 'Los Angeles', population: 3792621 },
  { name: 'New York', population: 8175133 }
]