Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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]
});
 
PREVIOUS NEXT
Tagged: #keys #wher #true #object #javascript
ADD COMMENT
Topic
Name
4+7 =