0
l = [[1, 2], [2, 3], [3, 4]]

console.log(l.includes([2, 3]))

Why does this return false? And how can i check if a list is in a list of list?

5
  • Generic object equality is defined as the objects reside in the same space in memory. You have two different arrays. They do not reside in the same memory space. Commented Jun 8, 2020 at 14:45
  • This may help: stackoverflow.com/a/201471/2358409 Commented Jun 8, 2020 at 14:46
  • toSearch=[1,2];l.some(k=>k.every(p=>toSearch.includes(p))) Commented Jun 8, 2020 at 14:46
  • @gorak That would also match [1, 2, 9] or [2, 1] Commented Jun 8, 2020 at 14:50
  • @Ivar if so then we can match it by taking stringify of it. Commented Jun 8, 2020 at 14:55

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.