जावास्क्रिप्ट में दिन का अंत

आइए वर्तमान दिन के अंत वाली तारीख वाली एक वस्तु प्राप्त करें:

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

वर्तमान दिन का अंत अगले दिन की आधी रात (1 सेकंड का अंतर) माना जा सकता है:

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

जैसा कि आप जानते हैं, इस मामले में शून्य को छोड़ा जा सकता है:

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

वैसे, आधी रात वर्तमान दिन का 24:00:00 समय भी होगा:

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

शून्य को छोड़ दें:

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

निर्धारित करें कि दिन के अंत तक कितने घंटे शेष हैं।