Advertisement
jargon

is it 10:00AM?

Sep 21st, 2024
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function isItTenAM() {
  2.     const now = new Date();
  3.     const hours = now.getHours();
  4.     const minutes = now.getMinutes();
  5.    
  6.     // Check if the current time is exactly 10:00 AM
  7.     return hours === 10 && minutes === 0;
  8. }
  9.  
  10. if (isItTenAM()) {
  11.     console.log("It's 10:00 AM!");
  12. } else {
  13.     console.log("It's not 10:00 AM yet.");
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement