Ball
EasyClasses3 min
Write a class Ball. Its constructor takes the ball type and stores it in the field ballType. If no type is given, the ball gets the type 'regular'.
Examples
new Ball().ballTypeReturns 'regular'
new Ball('super').ballTypeReturns 'super'
Loading the editor...
- No argument gives a regular ball
- The type comes from the argument
Hidden tests run on Submit