001function getChildNodes(elem) {
002 let textOutput = '';
003 const ulElement = document.getElementById(elem);
004 for (let i = 0; i < ulElement.children.length; i++) {
005 console.log(ulElement.children[i].innerText)
006 textOutput += '<p><a>'+ ulElement.children[i].innerText+'</a></p>';
007 }
008
009 const linksNav = ulElement.parentElement.parentElement.children[1];
010 linksNav.innerHTML = textOutput;
011 for(let i = 0; i<linksNav.children.length; i++)
012 {
013 linksNav.children[i].firstElementChild.setAttribute('href', linksNav.children[i].innerText.toLowerCase() +'.html');
014 }
015}
016
017window.onload = function() {
018 getChildNodes('pokemon');
019}