Koniec dnia w JavaScript

Sprawdźmy obiekt daty zawierający koniec bieżącego dnia:

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59);

Za koniec bieżącego dnia można również uznać północ następnego dnia (różnica wynosi 1 sekundę):

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);

Jak już wiesz, w takim przypadku zera można pominąć:

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);

Nawiasem mówiąc, północą będzie również czas 24:00:00 bieżącego dnia:

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 24, 0, 0);

Pomińmy zera:

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 24);
Задание 1

Określ, ile godzin pozostało do końca dnia.