A JavaScript class implementation