Posts Tagged ‘function’
Tuesday, July 1st, 2008
Most programming languages have a really obvious way of assigning default values to function arguments for when that parameter is omitted. JavaScript has a not so obvious but far more flexible way of doing it.
Default Values for Arguments
Tags: argument, default, function, javascript
Posted in What's New | No Comments »
Tuesday, May 20th, 2008
In the seventh and last tutorial on JavaScript functions we look at an alternative way of being able to add sophisticated JavaScript functionality into web pages without having to write much code yourself by using a pre-written library that includes most of the functionality that you require.
Function Libraries
Tags: function, javascript, library
Posted in What's New | No Comments »
Monday, May 19th, 2008
In this sixth introductory JavaScript tutorial on how to use functions we look at how you can return a value from the function that will be substituted into the calling code in place of the call.
Returning a Value
Tags: function, javascript, return
Posted in What's New | No Comments »
Wednesday, April 30th, 2008
The scope of a variable is the extent of the code in which the variable exists. For JavaScript variables defined within a function their scope is the function that they are defined in. Variables defined outside of functions as well as variables used without being first defined have global scope.
The Scope of Variables
Tags: function, global, javascript, local, scope, variable
Posted in What's New | No Comments »
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
Tags: function, javascript, optional, parameter
Posted in What's New | No Comments »
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
Tags: argument, function, javascript, parameter
Posted in What's New | No Comments »
Tuesday, April 15th, 2008
Defining a function in JavaScript is rather useless if you don’t actually make use of the function. In this second tutorial on JavaScript functions we look at how to call the functions that we have defined.
How to Call a Function
Tags: function, javascript
Posted in What's New | No Comments »
Monday, April 14th, 2008
The start of another series of introductory JavaScript tutorials. This one introduces the concept of functions and how to define them in JavaScript.
How to Define a Function
Tags: function, javascript
Posted in What's New | No Comments »