please dont rip this site

Microsoft® JScript™
Function Object
 Language Reference 
Version 2 

See Also                    Methods                    Properties


Description
Creates a new function.
Syntax 1
function functionname( [argname1 [, ... argnameN]] )
{
    
body
}
Syntax 2
var functionname = new Function( [argname1, [... argnameN,]] body );

The Function object syntax has these parts:

Part Description
functionname The name of the newly created function
argname1...argnameN An optional list of arguments that the function accepts.
body A string that contains the block of JScript code to be executed when the function is called.
Remarks
Syntax 1 is the standard way to create new functions in JScript. Syntax 2 is an alternative form used to create function objects explicitly.

The function is a basic data type in JScript. Syntax 1 creates a function value that JScript converts into a Function object when necessary. JScript converts Function objects created by Syntax 2 into function values at the time the function is called.

For example, if you want to create a function that adds the two arguments passed to it, you can do it in either of two ways:

Example 1
function add(x, y)
{
   return x + y;
}
Example 2
var add = new Function("x", "y", "return x+y");

In either case, you call the function with a line of code similar to the following:

add(2, 3);

Example 3

var add = function(x, y), {return x+y};

var funcName = function(){} is just another way to write function funcName(){} The first is more flexible than the second. It allows you to assign a function to a variable or property just like a string, number, or other kind of object. The second only allows you to create the function within the current context, while the first allows you to do something like this: myObj.funcName = function(){} The following is not valid: function myObj.funcName(){}


© 1997 by Microsoft Corporation. All rights reserved.


file: /techref/inet/iis/jscript/htm/js576.htm, 4KB, , updated: 2007/9/17 14:32, local time: 2008/9/5 01:21,
TOP NEW HELP FIND: 
38.103.63.61:LOG IN
©2008 PLEASE DON'T RIP! DO: LINK / DIGG! / MAKE!

 ©2008 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it!
<A HREF="http://www.piclist.com/techref/inet/iis/jscript/htm/js576.htm"> Function Object</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be reviewed) Just type in the box and press the Post button. (HTML welcomed!): A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Did you find what you needed?

  PICList 2008 contributors:
o List host: MIT, Site host massmind.org, Top posters @20080905 Apptech, Jinx, Xiaofan Chen, olin piclist, Alan B. Pearce, Vitaliy, William \Chops\ Westfield, Tamas Rudnai, JonnyMac, Cedric Chang,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Shultz Electronics, Timothy Weber, on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
  'What can I do?' - SiCKO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .