Facebook Pixel
Function Parameters and Arguments in JavaScript

What happens if you pass more arguments than parameters in JavaScript?

The answer

The extra arguments are ignored by the named parameters, but they are still accessible through the arguments object or a rest parameter. Missing arguments become undefined.

More FAQs in Function Parameters and Arguments in JavaScript

Parameters are the variable names listed in the function definition. Arguments are the actual values passed to the function when it is called.

If the caller passes undefined or omits the argument, the default value is used. Other falsy values like 0, null, or empty string do not trigger the default.

Rest parameters (...args) collect remaining arguments into a true array with methods like map and filter. arguments is array-like (has length and indices) but lacks array methods, and is not available in arrow functions.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Your learning library

Small steps. Big possibilities.

Find your next course. Build something great.

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.