How do i return an object key name only if the value of it is true?
I\'m using underscore and the only thing i see is how to return keys which is easy, i want to avo
Object.keys gets the keys from the object, then you can filter the keys based on the values
var obj = {1001: true, 1002: false}; var keys = Object.keys(obj); var filtered = keys.filter(function(key) { return obj[key] });
FIDDLE