Convert arguments object to Array in JavaScript

function fn(...args) {
}

Rest parameters are represented by the three dots before the last parameter. It receives all extra arguments as an Array.

Alternative: spread into Array

[...arguments]

Alternative: Array.from

Array.from(arguments)

ES5

Array.prototype.slice.call(arguments)

Convert iterable object to Array in JavaScript