In ECMAScript 3, the new operator was the only standard way to set the internal [[Prototype]] property of an object, in which case Crockford uses only the F temporary constructor function for this purpose.
The o argument of this method is set as the prototype property of the temporary constructor, and by calling new F(); , it creates a new empty object that inherits from F.prototype (see this question for more details on how new works).
For instance:
var a = { a: 1 }; var b = Object.create(a);
In the above example, we can say that the b internal [[Prototype]] property points to a .
Object.getPrototypeOf(b) === a;
In other words, b inherits from a .
In the same example, we could use an empty constructor, for example:
function F(){} F.prototype = a; var b = new F();
Remember also that the prototype function property is different from the [[Prototype]] property that all objects have, the prototype function property is used when they are called with a new operator to create a new object that inherits from this property.
In addition, keep in mind that now the ECMAScript 5 standard is implemented, and this gasket does not meet 100% of the specification, in fact there are some features of the standard Object.create method that cannot be emulated on ES3 .
See also:
source share