Posts Tagged ‘parameter’

Optional Parameters

Tuesday, April 29th, 2008

With JavaScript functions we don’t need to have a specific number of parameters to pass into a function. If we have situations where fewer parameters are required then we can set the JavaScript up to handle that simply by placing the mandatory ones first in the list and following them with the optional ones. JavaScript can go one better than that though since it provides a way handling the situation where you havw an unknown number of optional parameters. Whether you have no parameters at all or as many as someone takes the time to enter, JavaScript can handle it.

Optional Parameters

Same Function Different Variables

Monday, April 28th, 2008

Continuing on the introductory JavaScript series about functions this third tutorial looks at how we can define arguments within the function so that we can pass different parameters to the function each time we call it rather than having the function access our global variables and hence always process the same variables.

Same Function Different Variables