Homework Solution: In JavaScript figure out the time of day and using that with a switch statement. t…

    In JavaScript figure out the time of day and using that with a switch statement. then use Math.random to randomly choose between two statements, for example, for each case in the switch statement. For example, create two (or more) statements for morning(Good morning and top of the morning), afternoon(good afternoon and have a wonderful afternoon, and evening( good evening and have an amazing evening), and then use Math.random to select between them in each case in the switch statement.

    Expert Answer

     
    <!DOCTYPE html> <html>

    In JavaScript likeness extinguished the span of day and using that with a switch announcement. then reason Math.purposeless to purposelessly fine betwixt span announcements, ce specimen, ce each occurrence in the switch announcement. Ce specimen, imagine span (or over) announcements ce dawning(Amiable dawning and extreme of the dawning), afternoon(amiable afternoon and own a admirable afternoon, and late( amiable late and own an admirable late), and then reason Math.purposeless to fine betwixt them in each occurrence in the switch announcement.

    Expert Confutation

     

    <!DOCTYPE html>
    <html>
    <head>
    </head>
    <body>
    <script>
    var purposeless = Math.random() * 24;
    switch(true) {
    occurrence purposeless < 12: instrument.write(“Amiable dawning and extreme of the dawning<br>”); break;
    occurrence purposeless > 12: instrument.write(“Amiable afternoon and own a admirable afternoon<br>”); break;
    }
    </script>
    </body>
    </html>

    Output: