Any topic (writer’s choice)

Homework Part1:
Script 1: create a JavaScript program that defines, as an array, a list of 10 of your favorite things. Then, using any loop that you wish (i.e. for, forEach, do/while, etc) print each item from the array to the console.

Script 2: with the same script, add an if statement to test if you are on item #3, if so, print out “Wonderful, made it to item 3!”, and then continue with the loop as normal.

Homework Part 2: 
This time, propose how you can use a loop to enhance the weather alert program from last week. Discuss how the loop would function. You are not expected to write the code.

Last week work for reference:
Here will be the ideas for the program.
We will create string variable for the two state New York and Florida. We will ask the user to enter either New York or Florida. If the user enters New York we will have the following  script using logical comparisons.
1- If the temperature is less or equal 20 degree and has a wind speed less or equal to 45 mph, the program will display A Blizzard is ahead, careful on the roads.
2- if the temperature is more than 20 degree but less than or equal 25 degree and has wind speed more than 45 mph but less than or equal to 60 mph, the program will display “cool weather for outdoor activities”.
3-if the temperature is more than 25 but less than degree 30 and has wind speed more than 60 mph and less than 80 mph, the program will display Blustering winds stay inside!
4- if the temperature is more than 30 degree and has wind speed more than 80 mph, the program will display get ready for the heat waves and it will be very windy for the next days.
5- if the state enter is Florida, the program will display welcome to Florida state with it warm and nice weather and enjoy your time.

Leave a Reply

Your email address will not be published. Required fields are marked *