Adi
Adi3y ago

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?
6 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Adi
AdiOP3y ago
but I want to filter out both i.e true property items and undefined property items and use them for calculations ahead
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Adi
AdiOP3y 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
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
reactibot
reactibot3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/940257028042006628