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 and decrease the charge by Then log a message like this: 'Tesla going at with a charge of
Create an electric car object and experiment with calling 'accelerate', 'brake' and 'chargeBattery' charge to Notice hat happens when you 'accelerate'!
Test data:
Data car : 'Tesla' going at with a charge of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
