The case is simple - I\'ve got a following object:
Object {1: false, 2: true, 3: false, 4: false, 5: false, 6: false, 7: false, 8: true, 12: false, 13: false, 14
var keys = [];
_.each( obj, function( val, key ) {
if ( val ) {
keys.push(key);
}
});
There may be easier/shorter ways using plain Underscore.
In case anyone here uses Lodash instead of Underscore, the following is also possible, which is very short and easy to read:
var keys = _.invert(obj, true)[ "true" ];