title: How can we refresh an array displayed in an HTML element after an item is pushed to it?
body: <p>This file is a simple to do list generator. it starts with three sample items being displayed in a div from a JS array. onclick of button one "push" a prompt comes up and whatever the user adds gets added to the array in JS. this works fine as per the console. the second button "shift" pulls the first item off the list (in traditional to do list style) as the user does one item at a time.the push and shift button both run corresponding JS functions which do the work perfectly. in the console the array is updated each time wither is used. </p>
  
  <p>my question: how do i get the div to refresh the array "toDoListJoined" once a modification is made to the array "toDoList" thru the buttons???</p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
   &lt;html lang="en"&gt;
  
   &lt;head&gt;
   &lt;meta charset="utf-8" /&gt;
   &lt;title&gt;JavaScript To Do List&lt;/title&gt;
   &lt;/head&gt;
  
  
   &lt;body id="home"&gt;
     &lt;button id="push" onclick="pushPrompt()"&gt;Add something to the end of your list&lt;/button&gt;
     &lt;button id="shift" onclick="shiftIt()"&gt;Remove the first item from your list&lt;/button&gt;
  
  
   &lt;p id="listPlace"&gt;
   &lt;!--Here's where the magic happens--&gt;
   &lt;/p&gt;
  
   &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt;
     let toDoList = ["sample item 1", "sample item 2", "sample item 3"];
     let toDoListJoined = toDoList.join("&lt;br&gt;");
     let addItem = "";
  
  document.getElementById("listPlace").innerHTML = toDoListJoined;
  
  function pushPrompt() {
    addItem = prompt("What is the item you want to add to your list?", "Sample item");
    toDoList.push(addItem);
  }
  
  function shiftIt() {
    toDoList.shift();
  }
   &lt;/script&gt;
  
   &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>