Creating javascript classes with inheritance for practical app purposes