You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>
If time is less than 16 it will show "Have a nice day".
<br />
else it will show "Good night".
</p>
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = "";
var time = new Date().getHours();
if (time < 16) {
x = "Have a nice day";
} else {
x = "Good night";
}
document.getElementById("demo").innerHTML = x;
}
</script>
My lesson highlights! Check it out on your phone in Programming Hub: https://goo.gl/D2iETN
The text was updated successfully, but these errors were encountered:
My lesson highlights! Check it out on your phone in Programming Hub: https://goo.gl/D2iETN
The text was updated successfully, but these errors were encountered: