0

I have an object TS_List with a key thread_ts

and an array tsColValsArray

I want to remove items where tsColValsArray[i] is part of TS_List.thread_ts

This works for the third item in the array

var TS_List1 = TS_List.filter(item => !item.thread_ts.includes(tsColValsArray[2]));

but how do I filter for all the array

I thought it would be something like

var TS_List1 = TS_List.filter(item => !item.thread_ts.includes(tsColValsArray));
1
  • Can you share the TS_List array for find better solution Commented Feb 1, 2021 at 1:10

1 Answer 1

1

You can combile Array#some with Array#filter

var TS_List1 = TS_List.filter(item => !tsColValsArray.some(e => item.thread_ts.includes(e)));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.