Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Calculating the Speed of a Car | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
JavaScript Essentials for Beginners - 1768407374405

bookChallenge: Calculating the Speed of a Car

Opgave

Swipe to start coding

If we have the amount of distance (distance) a car has traveled, and the time it took to to cover that distance (timeTaken), we can calculate the average speed that car had throughout the journey, using the formula:

Speed = Distance / Time Taken

Note

The distance is in meters, and the time is in seconds.

The given code uses the two variables, distance and timeTaken to calculate and show the speed of a car.

  • Define a function called calcSpeed.
  • Put the given code inside the calcSpeed function.
  • Execute the calcSpeed function twice.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 47
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

close

bookChallenge: Calculating the Speed of a Car

Stryg for at vise menuen

Opgave

Swipe to start coding

If we have the amount of distance (distance) a car has traveled, and the time it took to to cover that distance (timeTaken), we can calculate the average speed that car had throughout the journey, using the formula:

Speed = Distance / Time Taken

Note

The distance is in meters, and the time is in seconds.

The given code uses the two variables, distance and timeTaken to calculate and show the speed of a car.

  • Define a function called calcSpeed.
  • Put the given code inside the calcSpeed function.
  • Execute the calcSpeed function twice.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 47
single

single

some-alt