Link an external js file from your script tag Use a combination of arrays or objects (choose wisely) to create a data st
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Link an external js file from your script tag Use a combination of arrays or objects (choose wisely) to create a data st
Link an external js file from your script tag Use a combinationof arrays or objects (choose wisely) to create a data structure toaccommodate the following: A group with 3 persons. Each person hasa name, dob, an image, and a set of likes (multiple) Sample Persondata: Wasim 1995-11-11https://media-exp1.licdn.com/dms/image/C4E03AQEILrj5lv6-lQ/profile-displayphoto-shrink_200_200/0/1586271371120?e=1659571200&v=beta&t=-CCY9Qj_Vci9d5_1mQlBQ8cl0q-YOfBPZNwaamTOoXw"Javascript", "Chocolate", "Starcraft 2" Phil 1964-01-24 (use yourown image here) "PHP", "Coffee", "Farmville" Ann 1972-11-09 (useyour own image here) "PHP", "Coffee", "Farmville" Create a functionthat accepts a group, returns a random person of the group. Testyour function by using console.log to output what the functionreturns. Use a loop to print out all the information about eachperson. (OPTIONAL: print the current age of each person) Now it'stime to output the data onto the HTML document! The following isprovided AS A GUIDE. Create a new section element. Give it an id of"group" Loop through the group array to: Create a heading elementCreate a text node for each heading element. Use the person namefor the heading text Add the text node to the heading element Addthe heading to the group section Create a div Create a text nodefor the dob Add the dob text node to the div Assign a class to thedob div Add the dob div to the group section Create the likesunordered list Loop through the likes array for this person Createa list item Create a text node that holds the information for eachlike Add the text node to the list item Add the list item to thelist Add the unordered list to the group section Create a p tagCreate a text node to show the random person's name (you created afunction earlier for funding a random person) Add that text node tothe p tag Add the p tag to the section Add the section to the bodytag All elements except the body and script tags should be createdusing JavaScript.