반응형
return
- The value of the first element in the array that satisfies the provided testing function. Otherwise, undefined is returned.(판별 함수를 만족하는 첫번째 값, 없으면 undefined를 리턴)
example
let arr = [1,2,3]
let find = arr.find(function(a){
return a === 1
}
console.log(find) //1
//Arrow Function
let arr = [1,2,3]
let find = arr.find(a => a===1)
console.log(find) //1
*참고 : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Array/find
반응형
'FrontEnd > Javascript' 카테고리의 다른 글
웹 프론트엔드 간단한 성능 검사(Chrome Task Manager) (0) | 2022.06.21 |
---|---|
윈도우 nvm 설치 후 npm 버전 확인시 오류 해결하기 (0) | 2022.06.07 |
윈도우에서 nvm을 통한 node 설치 에러 (0) | 2022.06.07 |
[javascript] Compare Date 특정시간과 현재 시간 비교 (0) | 2021.09.15 |
[Javascript] Cover Up Scrolling layout. [스크롤시 덮이는 레이아웃] (0) | 2020.05.02 |