let a = [1, 2, 3, 4, 5, 6, 7, 8];
let b = [1, 2];
let c = [3, 9];
function includes(arr1, arr2) {
return arr2.every(val => arr1.includes(val));
}
console.log(includes(a, b)); //true
微信图片_20210926142748.png
let a = [1, 2, 3, 4, 5, 6, 7, 8];
let b = [1, 2];
let c = [3, 9];
function includes(arr1, arr2) {
return arr2.every(val => arr1.includes(val));
}
console.log(includes(a, b)); //true
微信图片_20210926142748.png
本文标题:判断数组否包含另外一个数组
本文链接:https://www.haomeiwen.com/subject/tpeheltx.html
网友评论