The rest parameter syntax allows us to represent an indefinite number of arguments as an array. If you prefix a parameter name with the rest operator (…), the parameter receives all remaining parameters via an Array. Only the last parameter can be a “rest parameter”. This syntax was introduced in ECMAScript 2015(commonly called as ES6).

function foo(a, b, ...moreArgs) {
    console.log(a); //1
    console.log(b); //2
    console.log(moreArgs); //[3, 4, 5, 6, 7]
}

foo(1, 2, 3, 4, 5, 6, 7);

References