Challenge: Fixing the Speed Function
Task
Swipe to start coding
Previously, we created a calcSpeed function for calculating the average speed of a car.
Now you need to fix the function so that it can accept values from outside of the function.
- Remove the local variables
distanceandtimeTakeninside the function. - Add two parameters named
distanceandtimeTakeninside the parentheses of thecalcSpeedfunction. - Finally, call the
calcSpeedfunction twice with the corresponding arguments:1000meters,120seconds.1200meters,160seconds.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 50
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 1.33
Challenge: Fixing the Speed Function
Swipe to show menu
Task
Swipe to start coding
Previously, we created a calcSpeed function for calculating the average speed of a car.
Now you need to fix the function so that it can accept values from outside of the function.
- Remove the local variables
distanceandtimeTakeninside the function. - Add two parameters named
distanceandtimeTakeninside the parentheses of thecalcSpeedfunction. - Finally, call the
calcSpeedfunction twice with the corresponding arguments:1000meters,120seconds.1200meters,160seconds.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 50
single