Expand Minimize
1 out of 1 rated this helpful - Rate this topic

new Operator (JavaScript)

JavaScript - Internet Explorer 10

Creates a new object.

new constructor ([arguments]) 
constructor

Required. The constructor of the object. 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 pointer to the newly created object as the this pointer.

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

These are examples of valid uses of the new operator.

my_object = new Object;
my_array = new Array();
my_date = new Date("Jan 5 1996");

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps. See Version Information.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.