When the user clicks on a button, use a for loop to display the names stored in myFamily on the page somewhere.
Copy the previous part, so that you can keep your work for the prior part AND have a new copy to do this exercise on.
Instead of initializing the array using the Array() constructor function, use the constructor syntax (the one that uses the square brackets) to declare an empty array. Initialize the array by assigning the names of your family members to individual array elements starting with element 0.
In the loop that displays the contents of the array, make sure that you use the length property of the array to figure out how many times to iterate. From this point forwards, you should always use the length property (rather than a ‘hard-coded’ number) to figure out how many times to loop.
Then, assign more names to the array and verify that they're all being displayed by the loop without having to alter any of the loop control statements.
Part 3.2: In the head section of a page, declare two arrays of numbers. Initialize each of them with a random selection of about 5 values.
Display the results of each of these tasks to the document to verify that they were performed correctly. Make sure to use a loop (for loop or while loop – your choice) when displaying the results
Make sure that you actually use the function in an actual web page - adding this function to the page you built for the prior exercise would be a good way to go.
Create a page that contains an array, and store several (5+) different strings within it. Make sure that the strings are stored in a jumbled, random order. Something like ["Hotel", "Alpha", "Zebra", "Tagno", "Whiskey", "Foxtrot", "Echo"] would be great. Next, use the built-in sort method to reorder the numbers,. Print out the contents of the array to the web page, then sort the array, then display the now-sorted contents of the array.
Next, add a textbox and button to the page. When the user clicks on the button a click event handler should add whatever's in the textbox to an array (the array should start out empty). You should then display the contents of the array on the page, but make sure to display all the elements of the array in sorted order on the page.