JavaScript: Function's βargumentsβ Object
arguments
is a builtin variable, available in
function body defined using
function
.
(it is not in Arrow Function)
- The
arguments
object is a Array-Like Object. - Each slot is the value of argument, when a function is called.
function ff() { return arguments; } console.log(ff("a", "b")); // { "0": "a", "1": "b" } console.log(Array.isArray(ff()) === false);
π‘ TIP: never use the argument object. Always declare function parameters. It makes your code readable. If needed, use JavaScript: Function Rest Parameters .