Rest Parameters Back

Rest Parameters is similar to Spread Operators, which will also use ....

It allows functions to receive uncertained length of arguments:

function (a, b, ...args) {
    /** ... */
}

By far, in ES5, we will code like this:

function f(a, b) {
    var args = Array.prototype.slice.all(arguments, f.length);
}

With Rest Parameters, we can easily use an array to store rest arguments.

function fLength(...args) {
    console.log(args.length);
}

fLength();          /** => 0    */
fLength(1, 2);      /** => 2    */
fLength(1, 2, 3);   /** => 3    */
Empty Comments
Sign in GitHub

As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.

Notice: This plugin has used Cookie to store your token with an expiration.