JavaScript: Convert an object into an array

From The Travis van der Font Wiki
Jump to: navigation, search
function test()
{
    // converts this object of arguments into an array
    Object.values(arguments);
}

test(1, 2, 3, 4);
And now .includes() (an in exist array method) would work as it's treated like an array. However, the typeof will still return an object.

Example:

// returns a boolean since ID 2 exist in the array
const found_id_two = arguments.includes(2);

Additional Reference(s)