How can I convert the "arguments" object to an array in JavaScript? How can I convert the "arguments" object to an array in JavaScript? arrays arrays

How can I convert the "arguments" object to an array in JavaScript?


ES6 using rest parameters

If you are able to use ES6 you can use:

Rest Parameters

function sortArgs(...args) {  return args.sort(function (a, b) { return a - b; });}document.body.innerHTML = sortArgs(12, 4, 6, 8).toString();