title: how to make the menu appear in the page using only javascript and how to fix it
body: <p>so i am quite new to the programming, can some tell me how to fix this code so it shows a menu in the page this is the udacity nano degree project landing page.
  here is my code:</p>
  <pre><code> function fun (){
       // this code to loop our code 
    for (let i=0 ; i &lt; 5 ; i++) {
       const sectionID = section.id;
       const datanav = document.getElementById('data-nav');
       // we created new element li
          const linkfirst = document.createElement('li');
          // we created new element a
          const Alink = document.createElement('a');
           
            let textContent = document.createTextNode('datanav');
            Alink.textContent= datanav;
            linkfirst.appendChild(Alink);
            }
            // this code will make an event when we press on it it will take us to the right section through the page 
            
            fun.preventDefault();
            //this code wii make us able to scroll in a smoth way through the page
            element.scroll({
             top: 100,
             left: 100,
             behavior: 'smooth'
           });
           fun.addEventListener(&quot;click&quot;, fun );
           const clicked = document.querySelector('#' + datanav)
            clicked.scrollIntoView(behavior,smooth);
           document.getElementById('navbar__list').innerHTML= fun();
             fun('click');
  
  
   
  </code></pre>