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
- 웹팩
- styled-component
- socket.io
- 웹크롤링
- npx
- docker
- javascript animation
- 포트포워딩
- express
- typescript
- scrapping
- 반응형웹
- CDN
- sequelize
- Redux
- route
- react
- 회고
- Modal
- Recoil
- go
- cicd
- component
- graphql
- 정규표현식
- AWS
- 성능최적화
Archives
- Today
- Total
프로그래밍 공부하기
[20201216][이전블로그글]...arg 본문
Javascript문서를 보다보면 ...arg라는 표현이 있다. 이 것이 무엇을 의미하는지 정리해본다.
...arg라는 표현이 나오면 2가지 경우로 나누어 해석해야 한다.
1. Rest Parameter
- 파라미터로 넘어오는 것들을 배열로 묶는다.
- value1, value2... -> 배열
function printArgs(...args) {
console.log(args[1]) // -> 30출력
}
printArgs(10, 30, 40)
2. Spread syntax
- 배열 값을 펼친다.
- 배열 -> value1, value2...
function printArgsPlus(x,y){
console.log(x+y) // -> 7출력
}
let arr = [3,4];
printArgsPlus(...arr)
'Web > [JS] Common' 카테고리의 다른 글
논리연산자 AND, OR의 결과값 (0) | 2020.12.31 |
---|---|
내장고차함수: filter, map, reduce (0) | 2020.12.22 |
호이스팅(Hoisting) (0) | 2020.12.17 |
Assignment과 Shallow Copy와 Deep Copy (0) | 2020.12.17 |
[20201216][이전블로그글]Closure (0) | 2020.12.17 |
Comments