자바 스크립트에서 배열 교차를위한 가장 간단한 코드 자바 스크립트에서 배열 교차를 구현하기위한 가장 간단한 라이브러리가없는 코드는 무엇입니까? 쓰고 싶다 intersection([1,2,3], [2,3,4,5]) 그리고 얻다 [2, 3] 의 조합 사용 Array.prototype.filter과 Array.prototype.indexOf: array1.filter(value => -1 !== array2.indexOf(value)) 또는 주석에서 vrugtehagel이 제안한 것처럼 Array.prototype.includes더 간단한 코드를 위해 최신 코드를 사용할 수 있습니다 . array1.filter(value => array2.includes(value)) 이전 브라우저의 경우 : array1.f..