Get the answers you've been looking for with the help of IDNLearn.com's expert community. Find in-depth and trustworthy answers to all your questions from our experienced community members.

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.

Your participation means a lot to us. Keep sharing information and solutions. This community grows thanks to the amazing contributions from members like you. Accurate answers are just a click away at IDNLearn.com. Thanks for stopping by, and come back for more reliable solutions.