我有一个像这样的多维 javascript 数组。
[
["9", "16", "19", "24", "29", "38"],
["9", "15", "19", "24", "29", "38"],
["10", "16", "19", "24", "29", "38"],
["9", "16", "17", "19", "24", "29", "39"],
["10", "16", "17", "19", "24", "29", "39"],
["9", "15", "21", "24", "29", "38"]
.......
.......
]
确切地说是40左右
并且我有另一个名为 check 的数组,其中包含以下值
[9,10] //This is of size two for example,it may contain any number of elements BUT it only contains elements(digits) from the multidimensional array above
我想要的是我需要基于检查数组元素使多维数组唯一
1.Example if check array is [15]
then多维数组将是
[
["9", "15", "19", "24", "29", "38"],
//All the results which contain 15
]
2.Example if check array is [15,21]
then多维数组将是
[
["9", "15", "21", "24", "29", "38"]
//simply containing 15 AND 21.Please note previous example has only 15 in it not 21
//I need an AND not an OR
]
我曾尝试过 JavaScript IndexOf 方法,但它让我得到一个 OR'ed 结果,而不是 AND
提前致谢