I have an object. I want to get the keys if the value is true.
What I have tried :
const data = [{superadmin: true, admin: false, user: false}]
keys = Object.keys(data).filter(k => data[k]);
console.log(typeof(data));
console.log(data)
console.log(keys)
Expected Output :
["superadmin"]