mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-25 04:56:23 +00:00
499 B
499 B
date | id | title |
---|---|---|
20200922 | 4236e165-bf8b-45fd-9a4c-6cbb66916c45 | JavaScript Rest Parameters |
Introduction
Introduced in ES6
Syntax
function logAllArguments(...args) {
for (const arg of args) {
console.log(arg);
}
}
logAllArguments(1, 2, 3)
function logAllArguments(pattern, ...args) {
console.log(pattern)
for (const arg of args) {
console.log(arg);
}
}
logAllArguments("asdf", 1, 2, 3)