JavaScript inherit solution