Homework Solution: In JavaScript, write a random statement depending on the time of day. If the time is…

    In JavaScript, write a random statement depending on the time of day. If the time is less than 10, write a random statement that says either "good morning" or "top of the morning". If the time is less than 20, write a random statement that either says "Good afternoon" or "have a great afternoon". All else, write a random statement that says "good evening" or "Have a wonderful evening". The random statement must relate to the time of day.

    Expert Answer

     
    <script> function myFunction() {

    In JavaScript, transcribe a accidental proposition depending on the interval of day. If the interval is near than 10, transcribe a accidental proposition that says either “good morning” or “top of the morning”. If the interval is near than 20, transcribe a accidental proposition that either says “Good afternoon” or “have a vast afternoon”. All else, transcribe a accidental proposition that says “good evening” or “Have a surprising evening”. The accidental proposition must rehearse to the interval of day.

    Expert Retort

     

    <script>

    function myFunction() {

    var d = newlightlight Date();

    var n = d.getHours();

    if(n <= 10)

    {

    alert(“Good Morning”);

    }

    else if(n >= 11 && n <= 20)

    {

    alert(“Good Noon”);

    }

    else

    alert(“Good Evening”);

    }

    </script>