Create a global variable named places. The value of places should be an array, which you should
Question:
Create a global variable named places. The value of places should be an array, which you should populate with the names of five places of your choice. . Below your array definition, create a function with the name processPlaces(). Within the function, create a for statement. It should create a counter variable named i with a starting value of . As long as the counter variable is less than , it should increment by on each iteration. Each loop of the for statement should perform the following actions: a. Set the value of the listItem variable to the string "item" concatenated with (i + 1) Change the content of the element with the id equal to the value of the listItem variable to the value of the element in the places array with an index equal to the value of i. . Below the code for the processPlaces() function, add the following statement to run the function when the window finishes loading:
1. if (window.addEventListener) {
2. window.addEventListener("load", processPlaces, false);
3. }else if (window.attachEvent) {
4. window.attachEvent("onload", processPlaces);
5. }
Add comments to document.