Hi I am working on my Advanced CLient Side Scripting Course. How do you do number 3, 4a and 4b? 1.In your text editor, open index.htm from the HandsOnProject- folder in the Chapter folder. Enter your name and today’s date where indicated in the comment section in the document head. 2.At the bottom of the document, before the closing tag, create a new script section. 3.Within the script section create a global variable named places. The value of placesshould be an array, which you should populate with the names of five places of your choice. 4.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). b. Change the content of the element with the id equal to the value of the listItemvariable to the value of the element in the places array with an index equal to the value of i.
Hi I am working on my Advanced CLient Side Scripting Course. How do you do number 3, 4a and 4b?
1.In your text editor, open index.htm from the HandsOnProject- folder in the Chapter folder. Enter your name and today’s date where indicated in the comment section in the document head.
2.At the bottom of the document, before the closing </body> tag, create a new script section.
3.Within the script section create a global variable named places. The value of placesshould be an array, which you should populate with the names of five places of your choice.
4.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).
b. Change the content of the element with the id equal to the value of the listItemvariable to the value of the element in the places array with an index equal to the value of i.
Here is what I have so far.
<script>
var places = ["Scheels", "Walmart", "Target", "McDonalds", "Burger King"];
function.processPlaces(){
for (var count = 0; count < processPlaces.length; count++){document.write(processPlaces[count] + "<br />");
}
}
</script>
Trending now
This is a popular solution!
Step by step
Solved in 2 steps