> For the complete documentation index, see [llms.txt](https://yamoo9.gitbook.io/learning-react-app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yamoo9.gitbook.io/learning-react-app/tip-and-references/js-frequently-used-in-react/rest-paramenters.md).

# Rest paramenters

[전개 연산자(Spread Operator)](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Spread_syntax) `...`는 **값의 집합(배열) 또는 키:값의 집합(객체)에서 동작하며 집합에 포함된 원소를 전개할 때 사용**합니다. 뿐만 아니라, 함수에서는 [나머지 매개변수(Rest Paraments)](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Functions/rest_parameters)를 표현할 때 사용됩니다.

```javascript
const integers = [-1, 0, 32, -101, 24]

Math.max(...integers)

// ES5 —————————————————————————————————————————————————————————————

Math.max.apply(null, integers)
```

```javascript
const plusCount = (first, ...rest) => 
  rest.reduce((sum, next) => sum + next, first)

// ES5 —————————————————————————————————————————————————————————————

function plusCount() {
  var first = arguments[0];
  var rest = [].slice.call(arguments, 1);
  
  return rest.reduce(function(sum, next) {
    return sum + next;
  }, first);
}
```
