get keys wher value is true in object in javascript

JavaScript
var obj = {1001: true, 1002: false};

var keys = Object.keys(obj);

var filtered = keys.filter(function(key) {
    return obj[key]
});
Source

Also in JavaScript: