Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Calculating the Speed of a Car | Mastering Functions
Introduction to JavaScript

Scorri per mostrare il menu

book
Challenge: Calculating the Speed of a Car

Compito

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:

python

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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 3
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

book
Challenge: Calculating the Speed of a Car

Compito

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:

python

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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 4. Capitolo 3
Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt