JavaScript: Class Manipulation