To do the opposite of includes with JavaScript arrays, we negate the return value of includes
.
For instance, we write
const res = filteredResult.filter((e) => !e.selectedFields.includes("Red"));
to call filter
with a callback that checks if object e
‘s selectedFields
property in filteredResult
being looped through doesn’t include 'Red'
.