1. ES5 의 Array.prototype.foreach(), map(), filter() method 들은 배열안에 특정값만 바꾸려 해도 배열안에 모든 데이터를 확인하는 단점이 있다. 2. 이러한 단점을 보완한 ES6 의 Array.prototype.find() 는 조건을 만족하는 첫 번째 요소의 값을 반환한다. 3. 예:
const array = [1,5,7,8]; const found = array.find(element => ele > 6); console.log(found) // output: 7
댓글 1개
m 은 members 의 요소인 임의 명칭인 member 를 줄여쓰신건 아실거 같고..
1. ES5 의 Array.prototype.foreach(), map(), filter() method 들은
배열안에 특정값만 바꾸려 해도 배열안에 모든 데이터를 확인하는 단점이 있다.
2. 이러한 단점을 보완한 ES6 의 Array.prototype.find() 는
조건을 만족하는 첫 번째 요소의 값을 반환한다.
3. 예:
const array = [1,5,7,8];
const found = array.find(element => ele > 6);
console.log(found) // output: 7
이러한 특징을 사용해서 find 로 특정 id 를 찾아 넘긴것 같습니당