Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
JScript
JScript Reference
Language Reference
 new Operator
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
JScript 8.0
new Operator

Creates a new object.

new constructor[( [arguments] )] 
constructor

Required. Object's construction. The parentheses can be omitted if the constructor takes no arguments.

arguments

Optional. Any arguments to be passed to the new object's constructor.

The new operator performs the following tasks:

  • It creates an object with no members.

  • It calls the constructor for that object, passing a reference to the newly created object as the this pointer.

  • The constructor then initializes the object according to the arguments passed to the constructor.

These examples demonstrate some uses of the new operator.

var myObject : Object = new Object;
var myArray : Array = new Array();
var myDate : Date = new Date("Jan 5 1996");
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker