title: Refresh page and run function after - JavaScript
body: <p>I'm trying to refresh a page and then run a function once the refresh has been completed. However the code I have now, runs the function and then it only refreshes it, meaning I lose what the function did. Is there a way to solve this?</p>
  <p><strong>My code</strong></p>
  <pre><code>function reloadP(){
      document.location.reload();
      myFunction();
  }
  
  &lt;button onclick: &quot;reloadP()&quot;&gt;Click&lt;/button&gt;    
  </code></pre>