WDV221 Intro Javascript

Project-6 Arrays - In Class Exercises


Please complete the following exercises on this page. When complete post the page to your WDV221 folder on the server. Make a link in your WDV221 Intro Javascript page for this assignment. Contact your instructor and demonstrate that you have completed the assignment.

Using Blackboard complete the In Class Exercise Assignment. Download your Homework project and being working on it with your remaining time.

For each exercise use a comment line to put the Exercise number within the script. Also place a short description of what the script is doing.


For each of the following use the teams array provided in the script of this page.

1. Display the array in an alert.

2. Display the first row of the array in an alert.

3. Use a for loop to write each row of the array out to this page. Each row should be in a paragraph.

4. Use a while loop to write each row of the array out to this page. Each row should be in a paragraph.

5. Use a loop to write out each row of the array as list items within the following list.

6. Create an array called scores. It will have three rows. Load a 0 into each row. This is a parallel array to teams.

7. Use a loop to write out each row of the scores array as list items in the following list.

8. Create a function called displayTeams( ). It will use a loop to write out the Team name and score in the same paragraph. Run the function. Your output should look like:

Hustlers 0

9. Write a loop that will 3 to each value in the scores array. Run the displayTeams( ) function to display the update scores.

10. Write a function that will search the team array for a given name. If it finds the name it will display the team's score. If not a message "Team is not listed' will be displayed. HINT: Check your notes for an example to start with. Activate this function with a button.

 

Lookup Team Score