Question: Your tasks: Use a constructor function to implement an Electric Car ( called ' EV ' ) as a child class of 'Car'. Besides a

Your tasks:
Use a constructor function to implement an Electric Car (called 'EV') as a child "class" of 'Car'. Besides a make and current speed, the 'EV' also has the current battery charge in %('charge' property)
Implement a 'chargeBattery' method which takes an argument 'chargeTo' and sets the battery charge to 'chargeTo'
Implement an 'accelerate' method that will increase the car's speed by 20, and decrease the charge by 1%. Then log a message like this: 'Tesla going at 140kmh, with a charge of 22%
Create an electric car object and experiment with calling 'accelerate', 'brake' and 'chargeBattery' (charge to 90%). Notice hat happens when you 'accelerate'!
Test data:
Data car 1: 'Tesla' going at 120kmh, with a charge of 23%
 Your tasks: Use a constructor function to implement an Electric Car

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!