250x250
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
- choice()
- locals()
- Database
- __sub__
- shutil
- zipfile
- __len__
- randrange()
- fileinput
- discard()
- CSS
- View
- 파이썬
- mro()
- glob
- node.js
- inplace()
- __annotations__
- items()
- fnmatch
- count()
- decode()
- remove()
- JS
- __getitem__
- HTML
- MySQL
- shuffle()
- 오버라이딩
- MySqlDB
Archives
- Today
- Total
흰둥이는 코드를 짤 때 짖어 (왈!왈!왈!왈!왈!왈!왈!왈!왈!왈!왈!)
(JS) 스프레드 연산자 본문
728x90
반응형
스프레드(Spread) 연산자 -> 전개구문
- 모든 Iterable은 Spread가 될 수 있음
- 순회가능한 데이터는 펼쳐 질 수 있음
function 함수명(...Iterable){
[...Iterable]
{...obj}
}
function add(num1, num2, num3){
return num1 + num2 + num3;
}
add(10, 20, 30);
const nums = [10, 20, 30];
add(nums[0], nums[1], nums[2]);
add(...nums);
구조 분해 할당
const fruits = ['🍌', '🍊', '🍎', '🍓', '🍉'];
const [fruit1, fruit2, fruit3, fruit4, fruit5] = fruits;
const [fruit1, fruit2, ...others] = fruits;
✅ 참고!
const point = [1, 2];
const [x, y, z=0] = point
728x90
반응형
'HTML, CSS, JS' 카테고리의 다른 글
(JS) 예외처리 (0) | 2023.04.12 |
---|---|
(JS) 세트와 맵 (0) | 2023.04.11 |
(JS) 이터레이터, 이터러블, 제너레이터 (0) | 2023.04.11 |
(JS) 이벤트 (0) | 2023.04.11 |
(JS) Wrapper (0) | 2023.04.11 |
Comments