Playing around with classes in javascript