Adi – 14-45 Feb 7

If I want to filter items based on true property then is this correct way: const result = items.filter(item => item.someProperty === true) and if property not present i.e undefined then const result = items.filter(item => item.someProperty !== true) or can this be improved?
UU
Unknown User801d ago
A
Adi801d ago
but I want to filter out both i.e true property items and undefined property items and use them for calculations ahead
UU
Unknown User801d ago
A
Adi801d ago
no I am saying I want to separate items with true property and separate items with undefined property and do calculations on it separately
const result = items.filter(item => !item.someProperty)
const result = items.filter(item => !item.someProperty)
this does not work
UU
Unknown User800d ago