Front/JS & jQuery

[js] .find()

오선지♬ 2025. 1. 17. 20:46
728x90
반응형

JavaScript (배열)

이 .find()메서드는 주어진 조건을 만족하는 배열의 첫 번째 요소를 반환합니다.

array.find(callback(element, index, array), thisArg);

 

const numbers = [10, 20, 30, 40];
const found = numbers.find(num => num > 25);
console.log(found); // Output: 30
728x90
반응형

'Front > JS & jQuery' 카테고리의 다른 글

[JAVA] Stream은 순서를 지키지 않나요 ?  (0) 2025.01.22
[jQuery] 문자열 합치기  (0) 2025.01.18
[js] swiper 기본 옵션 설명  (0) 2025.01.16
[jQuery] $.grep()  (0) 2025.01.15
[js/jQuery] jQuery와 JavaScript의 .map() 차이  (0) 2025.01.13