4
How to Use Rest Parameters in JavaScript
source link: https://hackernoon.com/how-to-use-rest-parameters-in-javascript-ig3o35t3
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The arguments object
If you have some JavaScript experience, you might be familiar with the arguments object. The arguments object is an accessible object that contains the values of the parameters passed to a function.
0 reactions
function func1(a, b, c) {
console.log(arguments[0]);
// expected output: 1
console.log(arguments[1]);
// expected output: 2
console.log(arguments[2]);
// expected output: 3
}
func1(1, 2, 3);
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK