Published
- 1 min read
get keys wher value is true in object in javascript
The solution for this is noted below
get keys wher value is true in object in javascript
Solution
var obj = { 1001: true, 1002: false }
var keys = Object.keys(obj)
var filtered = keys.filter(function (key) {
return obj[key]
})
Try other methods by searching on the site. That is if this doesn’t work