Fin del día en JavaScript

Obtengamos un objeto de fecha que contenga el fin del día actual:

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

Se puede considerar como fin del día actual la medianoche del siguiente (diferencia de 1 segundo):

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

Como ya sabes, en este caso se pueden omitir los ceros:

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

Por cierto, la medianoche también será la hora 24:00:00 del día actual:

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

Omitamos los ceros:

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

Determina cuántas horas quedan hasta el fin del día.