1
2 개의 문자열 배열이 있습니다. 두 번째 배열의 모든 요소가 첫 번째 배열에 있는지 확인하려고합니다. 나는 이런 일에 Lodash/Underscore를 사용합니다. 하나의 배열이 배열에 있는지 검사 할 때 편리합니다 :배열의 모든 요소가 다른 배열에 있는지 확인하는 Lodash 메서드
그러나 배열 일 때, 나는 그것을 할 수있는 현재 방법을 볼 수 없습니다. 내가 한 일은 다음과 같습니다.
var arr1 = ['a', 'b', 'c', 'd'];
var arr2 = ['a', 'b', 'x'];
var intersection = _.intersection(arr1, arr2);
console.log('intersection is ', intersection);
if (intersection.length < arr2.length) {
console.log('no');
} else {
console.log('yes');
}
피들은 here입니다. 그러나 그것의 오랜 바람 -. 내장 된 Lodash 방법이 있습니까?