//方法一 var arr1 = [1,2,3,4,5,6,7,8]; //数组A var arr2 = [1,2,3,11,12,13,14];//数组B var temp = []; //临时数组1 var temparray = [];//临时数组2 for (var i = 0; i < arr2.length; i++) { temp[arr2[i]] = true;//巧妙地方:把数组B的值当成临时数组1的键并赋值为真 }; for (var i = 0; i < arr1.len…