Programmers-CoadingTest

머쓱이보다 키 큰 사람

순댓국 2024. 1. 11. 05:55
728x90
반응형
SMALL

배열함수 

Array.prototype.filter()

The filter() method of Array instances creates a shallow copy of a portion of a given array, filtered down to just the elements from the given array that pass the test implemented by the provided function.

 

 

 

const words = ['spray', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter((word) => word.length > 6);

console.log(result);
// Expected output: Array ["exuberant", "destruction", "present"]

 

 

 

뭘까!? 나는 이거보자마자 filter 생각나서 쓴건데... 써도 내가 의문이 생긴다.

다른 사람들 풀이보면 어질어질하다.

 

simple is best

728x90
반응형
LIST