Question: In Javascript 5 points: Declare and instantiate an array containing at least 5 numbers. NOTE: this can just be hard - coded, you don't need

In Javascript 5 points: Declare and instantiate an array containing at least 5 numbers. NOTE: this can just be hard-coded, you don't need to prompt users for this array.
5 points: Write the last number in the array to the element with class lastNum
5 points: Write the contents of the array to the HTML element with the class numArray
10 points: Loop through this array using a for loop, adding each value to a variable named sum
5 points: Write sum to the element with class numSum
10 points: Use the proper conditional structure to write to the element with class sumDescription:
If the sum is less than 20, write "small"
Otherwise, if the sum is between 20 and 100(inclusive), write "medium"
Otherwise, write "large"
5 points: Declare two empty arrays named foods1 and foods2
10 points: Do the following until the user enters quit (hint: you have to do this at least once):
Gather input with this popup prompt: let input = prompt("Enter a food, or "quit" to stop.");
If the user didn't enter quit, append this string to the array foods1
5 points: Write the contents of the foods1 array to the HTML element with the class foods1Array
5 points: Write true or false to the HTML element with the class appleSearch, based on whether the foods array contains "apple"
15 points: While the foods1 array still has values (length >0), do the following:
Remove the current first value in foods1
Append this value to the end of foods2
5 points: Write the following to the specified HTML elements:
Contents of foods1 to the element with class finalFoods1
Contents of foods2 to the element with class finalFoods25 points: Declare and instantiate an array containing at least 5 numbers. NOTE: this can just
be hard-coded, you don't need to prompt users for this array.
5 points: Write the last number in the array to the element with class lastNum
5 points: Write the contents of the array to the HTML element with the class numArray
10 points: Loop through this array using a for loop, adding each value to a variable
named sum
5 points: Write sum to the element with class numSum
10 points: Use the proper conditional structure to write to the element with
class sumDescription:
If the sum is less than 20, write "small"
Otherwise, if the sum is between 20 and 100(inclusive), write "medium"
Otherwise, write "large"
5 points: Declare two empty arrays named foods 1 and foods 2
10 points: Do the following until the user enters quit (hint: you have to do this at least once):
Gather input with this popup prompt: let input = prompt("Enter a food, or "quit" to stop.");
If the user didn't enter quit, append this string to the array foods1
5 points: Write the contents of the foods 1 array to the HTML element with the
class foods1Array
 In Javascript 5 points: Declare and instantiate an array containing at

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!