javascript object call one key code example
Example 1: get keys wher value is true in object in javascript
var obj = {1001: true, 1002: false};
var keys = Object.keys(obj);
var filtered = keys.filter(function(key) {
return obj[key]
});
Example 2: object.keys
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.keys(object1));
// expected output: Array ["a", "b", "c"]