Javascript examples for Object:Constructor
Apply/Call with constructor
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript"> function Foo(a,b,c) { if( arguments.length === 0 )// w w w. ja v a 2s. c o m return this; this.a = a; this.b = b; this.c = c; } var my = new Foo; Foo.apply(my, ["a", "b", "c"]); console.log(my); </script> </body> </html>