You are here: Home / Topics / Convert Hours into Seconds in JavaScript

Convert Hours into Seconds in JavaScript

Filed under: JavaScript on 2023-08-06 20:57:35

Write a function that converts hours into seconds.
 

Examples:

howManySeconds(2) ➞ 7200

howManySeconds(10) ➞ 36000

howManySeconds(24) ➞ 86400

Notes:

   60 seconds in a minute, 60 minutes in an hour

 

<script>

function howManySeconds(hour){

var seconds = hour * 60 * 60 *;

}

 

var hour = 2;

console.log(howManySeconds(hour)); /// this will print 7200 in console.

 

</script>


About Author:
M
Mr. Dubey     View Profile
Founder of MCQ Buddy. I just like to help others. This portal helps students in getting study material free. Share your stuff here so that others can get benefitted.