|University||Ontario College (OC) Canada|
|Subject||Web - Design / Development|
OBJECTIVE: Work with arrays and iterative code
Includes these three variables, updating the targetName value to match your first name:
const arrayOfNumbers = [4, 0, -4, 13, -2];
const students = [“Jane”,”Joe”,”Jack”,”Jill”,”Jerome”];
const targetName = “Jill”; //change “Jill” to your first name
Use an array. push() to add three more first names to the student’s array. One of those three names should
be your first name.
Display the total number of students in the array. Iterate over the student’s array and display each student name as a LI tag in a UL
If the student name matches the target name include a ‘target found’ message along with the student name in the LI tag.
After displaying the student array, provide a message that summarizes whether the target name was or was not found in the array.
To test your script thoroughly, change the value of the target name so that it sometimes does match a student in the array, and sometimes it does not.
Use iterative code to display each of the numbers in the array of numbers array, and then perform a count down or count up from that number to zero. For example, if the number is 4, display 4 3 2 1 0. If
the number is -3 display -3 -2 -1 0. If the number is 0, display a message saying there is no counting to be done.