Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 도커기본개념
- 도커 컨테이너
- 코딩테스트
- JavsScript
- IT
- HTTP/2.0
- CS
- docker
- HTTP
- 운동
- gunicorn
- Jupyter notebook
- 취준생
- 컴퓨공학과
- HTTP/3.0
- 프론트엔드
- Nginx개념
- HTTP버전
- 컴퓨터공학과
- Nginx
- http 메소드
- HTTP/1.0
- 헬스
- 도커명령어
- 백준
- 자바스크립트
- Python
- CS기술면접
- Javascript
- HTTP/0.9
Archives
- Today
- Total
dogo_ day
JavaScript Array.from 본문
Array.from()
메서드는 유사 배열 객체(array-like object)나 반복 가능한 객체(iterable object)를 얕게 복사해 새로운 Array
객체를 만듭니다.
출처 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/from
// Using an arrow function as the map function to
// manipulate the elements
Array.from([1, 2, 3], x => x + x);
// [2, 4, 6]
// Generate a sequence of numbers
// Since the array is initialized with `undefined` on each position,
// the value of `v` below will be `undefined`
Array.from({length: 5}, (v, i) => i);
// [0, 1, 2, 3, 4]
// from() 메서드의 length 속성은 1입니다.
🌈 0부터 999까지의 정수 30000개를 담은 배열 생성
let arr = Array.from({length: 30000}, () => Math.floor(Math.random() * 1000));
참고자료
패스트캠퍼스 - JavaScript 코딩테스트 131개 예재 & CS지식으로 끝내기