给定两个数组,编写一个函数来计算它们的交集。 var intersection = function(nums1, nums2) { return Array.from(new Set(nums1.filter(num => nums2.indexOf(num) !== -1))) }