# 获取两个数组中不同的值

使用
import { difference } from 'util-snippets'

/**
 * 示例:difference([1, 2, 3], [1, 2, 4]); // [3]
 */

difference(array1,array2); 
代码
const difference = (a: [], b: []) => {
  const s = new Set(b);
  return a.filter(x => !s.has(x));
};