javascript - Map object keys to array is value is true -



javascript - Map object keys to array is value is true -

i have object pks , extract keys value true

pks = {3: false, 7: true, 2: true}

is there underscore function can homecoming [7, 2]? i've tried _.invert lost 1 of values in process i'm looking alternative

you can builtin functions, no need underscore:

object.keys(pks) .filter(function(k){return pks[k]}) .map(number)

javascript underscore.js

Comments

Popular posts from this blog

php - How to pass multiple values from url -

php - Laravel not returning controller -

c# - Confused on how to specify a Platform and Version while using ChromeOptions for RemoteWebDriver with Selenium donNet since recent updates -