배열 요소가 전부 특정 조건을 만족하는지 테스트
모든 요소가 조건을 만족하면
true, 하나라도 아니라면 false 반환arr.every(callback[, thisArg])
callback: 각 요소를 시험할 함수. 다음 세 가지 인수를 받습니다.
currentValue처리할 현재 요소.index Optional 처리할 현재 요소의 인덱스.array Optional every를 호출한 배열.thisArg Optional:
callback을 실행할 때 this로 사용하는 값.const isBelowThreshold = (currentValue) => currentValue < 40; const array1 = [1, 30, 39, 29, 10, 13]; console.log(array1.every(isBelowThreshold)); // 배열의 모든 요소가 40보다 작은지 테스트 // expected output: true