js class implementation