Published: 28 May 2018 › Updated: 28 May 2018
Javascript - Array .form() .isArray()
공식문서는 MDZ - moz
본인이 기억하기 위해, 실제 실무에서 사용했거나 사용된걸 본 API 만 포스팅.
- Array()
- isArray()
- of()
- concat()
- copyWithin()
- entries()
- every()
- fill()
- filter()
- find()
- findIndex()
- forEach()
- includes()
- indexof()
- join()
- keys()
- map()
- pop()
- push()
- reduce()
- shift()
- slice()
- some()
- sort()
- splice()
- toString()
- values()
Array.form()
function f() {
return Array.from(arguments);
}
f(1, 2, 3);
// [1, 2, 3]
인자에 값을 넣으면 배열로 리턴해줌
실무에서는
최초 값이 없는 빈 배열을 넣을때 사용했습니다
...
else {
Array.from({length: 5}, (v, k) => k);
}
실제 react에서 최초 빈값을 설정할때 아주 유용함
특히, 한개 이상의 최초 데이터를 설정할때 좋다.
본인은 new Array()를 사용하기도 하나
index를 활용하기에 더 효율적으로 사용하기에
아주 좋습니다.
isArray()
Array.isArray(obj) // true/false
단순히 배열인지 오브젝트인지 스트링인지
정확한 필터링 하지만,
본인은 써본적이 없음
화면단에 머물러있는 개발자이기에
아직 ...
백단에서는 많이 쓰이는것 같다
이건 체크만 해두고
백단 작업할때 다시 정리해보자
of()
Array.of(7); // [7]
Array.of(1, 2, 3); // [1, 2, 3]
이것!! 아주 유용하게 많이 쓰였다
Leave Javascript - Array .form() .isArray() to:
Read more #javascript posts
Best Posts From wantbycre
We have not curated any of wantbycre's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.