JavaScript Function Parameters

JavaScript work does not play out any keeping an eye on parameter esteems (contentions).

Function Parameters and Arguments

functions can have parameters:


functionName(parameter1, parameter2, parameter3) { 

code to be executed 


Parameter Defaults

If a capacity is called with missing contentions (not exactly announced), the missing qualities are set to: undefined

Sometimes this is worthy, yet some of the time it is smarter to appoint a default an incentive to the parameter:.

If a capacity is called with such a large number of contentions (more than announced), these contentions can be achieved utilizing the contentions object.


work myFunction(x, y) { 

in the event that (y === unclear) { 

y = 0; 



The Arguments Object


x = sumAll(1, 123, 500, 115, 44, 88); work sumAll() { var I; var whole = 0; for (I = 0; I < arguments.length; i++) { whole += arguments[i]; } return whole; }

Arguments are Passed by Value .

Changes to contentions are not obvious (reflected) outside the function.