2024-02-17 19:55:56 +01:00
|
|
|
---
|
|
|
|
title: Variadic
|
2024-03-17 19:19:56 +01:00
|
|
|
jargon: true
|
2024-02-17 19:55:56 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
A **variadic** function is a function that accepts a variable number of arguments.
|
|
|
|
|
|
|
|
For example, JavaScript's `console.log` method is variadic:
|
|
|
|
|
|
|
|
```js
|
|
|
|
console.log('one')
|
|
|
|
console.log('one', 'two')
|
|
|
|
console.log('one', 'two', 'three')
|
2024-02-18 16:09:43 +01:00
|
|
|
console.log('It', 'works', 'regardless', 'of', 'how', 'many', 'arguments', 'you', 'pass')
|
2024-02-17 19:55:56 +01:00
|
|
|
```
|