Docunext

  • About

Anatomy of a function

May 11th, 2007

A function allows you to process data on demand. For example, on the site sandbox.sketch99.com, we use javascript functions to allow visitors to change the color of text by calling a function and passing it the user's desired color as an argument.

A function looks something like this:

function myfunction(){}

The word function tells the computer that the information to follow is in fact a function.

The next item "myfunction" is the name of the function. Each function has a "basket" which is used to specify what, if anything, can be passed as arguments to the function.

Inside the curly brackets is the action. This is what the function is doing.

Yearly Indexes: 2010 2003 2005 2006 2007 2008 2009 2004 2011 2012 2013 2015 2019 2020