We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13be80a commit 02942ebCopy full SHA for 02942eb
1-js/05-data-types/10-date/7-get-seconds-to-tomorrow/solution.md
@@ -13,3 +13,19 @@ function getSecondsToTomorrow() {
13
return Math.round(diff / 1000); // convert to seconds
14
}
15
```
16
+
17
+Alternative solution:
18
19
+```js run
20
+function getSecondsToTomorrow() {
21
+ let now = new Date();
22
+ let hour = now.getHours();
23
+ let minutes = now.getMinutes();
24
+ let seconds = now.getSeconds();
25
+ let totalSecondsToday = (hour * 60 + minutes) * 60 + seconds;
26
+ let totalSecondsInADay = 86400;
27
28
+ return totalSecondsInADay - totalSecondsToday;
29
+}
30
31
+```
0 commit comments