Saturday, December 20, 2014

New Keyword in JavaScript

The new keyword create an instance of a user-defined object.
The new keyword create an instance of a built-in object types that has a constructor function.

Below program create an instance of a user-defined object.

Below program create an instance of a built-in object types that has a constructor function.

New operator takes a function constructor as a argument and create a new object which is extend from the prototype property of the function constructor and then execute the function constructor with the content of the newly created object and then return the newly created object.


this value with new keyword

When a function is used as a constructor (with the new keyword), its "this" is bound to new object being constructed.


Link 1 - new keyword
Link 2 - new keyword
Link 3 - new keyword
Link 4 - new keyword

No comments:

Post a Comment