I have this kind of object
I want to get new object with keys that have "exist === true"
const someObj = {
super: {
exist: true
},
photo: {
exist: true
},
request: {
exist: false
}
}
const newObj = Object.entries(someObj).reduce((newObj, [key, val]) => {
if (this.key.exist) { // how to check "exist" is true ?
return { ...newObj, [key]: val }
}
}, {});
console.log(newObj);