JavaScript Code to print “Good Day” using IF-ELSE
The JavaScript Code to print “Good Day” using an if-else condition: JavaScript var time = new Date().getHours(); if (time < 12) { console.log(“Good morning!”); } else if (time < 18) { console.log(“Good day!”); } else { console.log(“Good evening!”); } This code first gets the current time of day using the Date object’s …
JavaScript Code to print “Good Day” using IF-ELSE Read More »