![]() ![]() The name and email properties should be added as two paragraphs inside the list item. The second argument to the function, targetList, is an unordered HTML list to which each customer should be added as a separate list item. The first argument to the function, customers, is an array of objects with the name and email properties. Implement the showCustomers function so that it renders customers as list items. Let relative = closestRelative(parent, 'Mike') Ĭonsole.log(relative & relative.tagName) // prints MIKE ![]() If no matching relative is found the function should return null.įor example, the below code should print 'MIKE' for the given family tree: let parent = document.getElementsByTagName('James').If several children in the same generation have the same name, then the first child in the tree is considered the closer relative.Children are more closely related to the parent than grandchildren.Each member of the family, including children, may also be a parent to one or more children.The parent parameter is the HTML element of which the closest relative will be a descendant.Implement the closestRelative function so that when a parent HTML element is passed, the function returns the parent's closest relative whose name matches the relativeName, and obeys the following rules: The following HTML represents a family tree:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |