Javascript examples for Object:Constructor
return the named function constructor instance with new operator
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w.ja v a 2 s. c o m*/ var foo = function () { return new moo(); } var moo = function () { return this; } var myFoo = new foo(2); if(myFoo instanceof moo){ console.log("moo"); } if(myFoo instanceof foo){ console.log("foo"); } } </script> </head> <body> </body> </html>