js 澶氫釜鏁扮粍鍙栧叾鐩稿悓鐨勫厓绱犲嵆瀛愰泦
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js 澶氫釜鏁扮粍鍙栧叾鐩稿悓鐨勫厓绱犲嵆瀛愰泦相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/val' title='val'>val include rom 瀛愰泦 OLE clu from 涓暟 鏁扮粍
鎻忚堪锛?br />
let a = [1,2,3,5,9,9,9,2,2,8,10,10];
let b = [10,11,2,3,4,5,9,9,9,2,8,10];
let c = [2,5,6,3,4,0,8,2,9,9,9,8,8,9,8,9,8,10];
let d = [a,b,c];
let e = [];
d.map((val1) => {
if (e.length == 0) {
e = val1;
} else {
e = e.filter((val2) => {
return val1.includes(val2);
})
}
})
console.log(e);// (11) [2, 3, 5, 9, 9, 9, 2, 2, 8, 10, 10]
console.log(new Set(e));// Set(6) {2, 3, 5, 9, 8, 10}
console.log(Array.from(new Set(e)));// (6) [2, 3, 5, 9, 8, 10]
以上是关于js 澶氫釜鏁扮粍鍙栧叾鐩稿悓鐨勫厓绱犲嵆瀛愰泦的主要内容,如果未能解决你的问题,请参考以下文章