Javascript example in class