js의 Array.prototype.some() 함수에 대해 알아보도록 하자.
some()메서드는 배열 안의 어떤 요소라도 주어진 판별 함수를 통과하는지를 테스트한다. 빈 배열에서 호출 시 무조건 false를 반환한다.
arr.some(callback[, thisArg])
const array = [1, 2, 3, 4, 5];
// checks whether an element is even
const even = (element) => element % 2 === 0;
console.log(array.some(even));
// expected output: true
const array = [1];
// checks whether an element is even
const even = (element) => element % 2 === 0;
console.log(array.some(even));
// expected output: false
const array = [];
// checks whether an element is even
const even = (element) => element % 2 === 0;
console.log(array.some(even));
// expected output: false
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/some