the var x = new Object () is not necessarily created with new, and I'm not sure.
x.__proto__ = A.prototype
var result = A.call (x)
if (typeof (Result) = = "Object") {
return result;
}
return x;
Constructor property of an object
Let's take a look at the first question left in the previous article.
function Base () {}base.prototype.a = 1var base = new base (); function derived () {}derived.prototype = Base;var d = new Derived ()
, new is the idea of creating an object. So which of the web effects can be new? Please see:
1>var i = new number (' 1 ');
2>var B = New Boolean (true);
3>var s = new string (' a ');
4>var f = new function (' alert (1); ');
5>var obj = new object;//var obj = new Object ();
6>var temp = function (A, B)
{
THIS.A = A;
this.b = b;
}
var t = new temp;
In these 6 cases typeof i,typeof b,typeof s,typeof f,typeof obj,typeof t return the ' object ' string of JS.