In the book Javascript: The good parts the author uses following code to create objects
if (typeof Object.create !== 'function') {
Object.create = function (o) {
var F = function () {};
F.prototype = o;
return new F();
};
}
var another_stooge = Object.create(stooge);
The function is meant to create an object but it returns a function instead. (Reference - Chapter 3, Page number : 22)
Object.createreturns a new instance of the object passed into it.Object.crearereturnsF()which is a functionnew F(). Please read the documentation for Object.create and the new keyword.