---
date: 2020-09-22
id: 4236e165-bf8b-45fd-9a4c-6cbb66916c45
title: JavaScript Rest Parameters
---

# Introduction

Introduced in [ES6](20201030093404-es6)

# Syntax

``` javascript
function logAllArguments(...args) {
    for (const arg of args) {
        console.log(arg);
    }
}

logAllArguments(1, 2, 3)
```

``` javascript
function logAllArguments(pattern, ...args) {
    console.log(pattern)
    for (const arg of args) {
        console.log(arg);
    }
}

logAllArguments("asdf", 1, 2, 3)
```
