good way to do js class