javascript - What is returned from a constructor? -
If I return the object to some value or constructor function, what will be var?
function microcorrector () {// what will happen when return 5; // if you return some objects; } Var n = new MyConstroctor ();
In both cases what will get n?
Actually this is a quiz question, what will be the answer?
What is the return from a custom object constructor?
A) Neo-Tat Objects
B) Undefined - Constructor does not return the value c) Whatever the return statement, d) Whatever the return statement; Neo-instant object if there is no return statement
I found this great link:
The second piece of magic that prevents the above is the constructor's ability to return a specific, possibly pre-existing object, instead of a reference to a new example. Allow the number to manage; Probably for the reasons of limited resources or whatnot
var g_deebee = new Deebee (); Function debe () {returns g_deebee; } Var db1 = new DEB (); Var DB2 = new DEB (); If (DB1! = DB2) error ("JS constructor returned wrong object!");
Comments
Post a Comment