Function.prototype.new = function ( ) {
// Create a new object that inherits from the
// constructor's prototype.
var that = Object.create(this.prototype);
// Invoke the constructor, binding –this- to
// the new object.
var other = this.apply(that, arguments);
// If its return value isn't an object,
// substitute the new object.
return (typeof other === 'object' && other) || that;
});
This is an alternate implementation of constructor instantiation from JavaScript: The Good Parts. My question is why is do we need var other = ... Can't we just return the variable that?