function of extend a javascript class