The rest parameter syntax allows a function to accept an indefinite number of arguments as an
array
, providing a way to represent variadic functions in JavaScript.(c) MDN
🐊Putout plugin adds ability to convert arguments
to rest
.
npm i @putout/plugin-convert-arguments-to-rest -D
{
"rules": {
"convert-arguments-to-rest": "on"
}
}
function hello() {
console.log(arguments);
}
function hello(...args) {
console.log(args);
}
MIT