Javascript inheritance
First of all, it seems like you're reinventing the wheel here. You didn't provide any context for what this is for so I'll try to cover all bases.

If you are using this as part of a bigger project, I'd recommend abandoning this approach and picking up something like Prototype.js or maybe Ember.js if you're ambitious. Alternatively, take a look at how CoffeeScript does it. CoffeeScript's underlying JS is pretty messy but it's significantly simpler than yours AND supports inheritance.

If this is just an educational exercise, I can point out a few problems with your code that I see.


extend_obj(Extended.prototype, constructor);

This seems to be copying the instance's properties onto the class prototype. This doesn't make much sense as the instance's properties should be separate.

var instance = new SubClass({ name: "custom name" })

This actually instantiates an Extended (aka SubClass) object with no instance properties and modifies the Extended prototype to have a name property of "custom name". This is very strange behavior.



In general, when trying to emulate Classes in JS, the prototype is where instance methods go or, possibly, default values for properties. However, an instance (created with new) should have no effect on it.