Welcome to Westonci.ca, the place where your questions find answers from a community of knowledgeable experts. Find reliable answers to your questions from a wide community of knowledgeable experts on our user-friendly Q&A platform. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.

write a program that asks the user how far they ran and then how long they ran and prints out their speed in miles per hour javascript

Sagot :

Answer:

var distance = prompt("How far did you run? in miles");

var time = prompt("How long did you run? in hours");

function calSpeed(miles, hours){

   var speed = miles / hours;

   console.log(speed,"m/h")

calSpeed(distance, time);

Explanation:

The javascript uses the prompt function to get user inputs for the distance and time variables. The calSpeed function calculates and prints out the speed of the runner with the arguments, distance and time.