current position:Home>How does JavaScript understand this algorithm

How does JavaScript understand this algorithm

2022-04-29 12:12:23CSDN Q & A

img

How to understand hours 、 branch 、 Second calculation formula , I don't understand why I have to divide , Please elaborate , thank you

// Hours
var h=parseInt(times/60/60%24);
// branch
var m=parseInt(times/60%60);
// second
var s=parseInt(times%60);




Take the answer :

It is known that one day there will be 24 Hours , There is... In an hour 60 minute , One minute has 60 second .

We know that one day 86400 second
that , hypothesis times=86400
We can draw , times/60/60/24=1 just 1 God 0 when 0 branch 0 second .
Empathy , hypothesis times=86401
We can draw times%60=1 The result is :1 God 0 when 0 branch 1 second .


copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/112/202204221933531673.html

Random recommended