1) Array.isArray(obj)
2) arr.forEach(callback)
3) arr.map(callback)
[1, 3, 5].map(x => x * 2);
// [2, 6, 10]
4) arr.filter(callback)
: arr.filter(callback(element[, index[, array]])[, thisArg])
[1, 3, 5].filter(currentElement => currentElement > 1);
// [3, 5]
5) arr.pop()
6) arr.slice([begin][,end]) - immutable
var animals = ['ant', 'bison', 'camel', 'duck', 'elephant'];
console.log(animals.slice(2));
// ["camel", "duck", "elephant"]
console.log(animals.slice(2, 4));
//["camel", "duck"]
7) arr.sort([compareFunction(a,b)]) - mutable
: compareFunction은 정렬 순서를 정의하는 함수이다. 생략하면 배열은 각 요소의 문자열 변환에 따라 각 문자의 유니 코드 코드 포인트 값에 따라 정렬된다.
추가로 볼만한 내용
this의 적용 (0) | 2019.04.15 |
---|---|
Closure Module Pattern (0) | 2019.04.15 |
코딩 스타일 Part 3. Operators and keywords (연산자와 키워드) - Javacript (0) | 2019.04.13 |
코딩 스타일 Part 2. Quoting and Semicolons - Javascript (0) | 2019.04.13 |
코딩 스타일 Part 1. 이름 짓기 - Javascript (0) | 2019.04.13 |
댓글 영역