1. Home
  2. Computing & Technology
  3. JavaScript

Subroutine

By Stephen Chapman, About.com

Definition: A subroutine is a group of statements that have been collected together and given a name. This group of statements can then be run from several different places within the program by calling it by name. You can pass parameters to a subroutine telling it what to process. A subroutine diifers from a function in that a function returns a value while a subroutine does not. While other programming languages may use different means of calling functions and subroutines - eg 'call subroutine();' and 'x = function();' - Javascript makes no distinction between subroutine and function calls.
Examples:
mySubroutine(x,y);
Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.