Rest Parameters

suggest change
function argumentLength(...args) {
    return args.length;
}

argumentLength(5) // returns 1
argumentLength(5, 3) //returns 2
argumentLength(5, 3, 6) //returns 3

By prefacing the last argument of your function with ... all arguments passed to the function are read as an array. In this example we get pass in multiple arguments and get the length of the array created from those arguments.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents