Extendable object in javascript