const arr = [1,2,3,4,5];
const check = arr.some(x => x === 6);
const check2 = arr.some(x => x === 5);
console.log(check); //false
console.log(check2); //true
콜백 내에 있는 식이 참이 될 때까지 배열을 반복해서 확인!
배열 안에 참이 하나라도 있으면 true
하나도 없으면 false
const arr = [1,2,3,4,5];
const check = arr.some(x => x === 6);
const check2 = arr.some(x => x === 5);
console.log(check); //false
console.log(check2); //true
콜백 내에 있는 식이 참이 될 때까지 배열을 반복해서 확인!
배열 안에 참이 하나라도 있으면 true
하나도 없으면 false
Comments