title: Removing alert() function crashes my code
body: <p>I try to create a running infotext on an infoscreen. The Text starts running from the right corner of the screen and leaves on the left side. This process repeats without a limit recursively.</p>
  
  <p>Everything seems to work great, but when I remove the alert after debugging, the text don't start running from the right corner but from the left. Also the programm runs only one time.</p>
  
  <p>HTML:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function setStaticData() {
    sessionStorage.setItem('headerWidth', document.getElementById('header').scrollWidth);
  }
  
  function getStaticData() {
    return sessionStorage.getItem('headerWidth');
  }
  
  function animation() {
  
    //get element, its width &amp; time param
    var header = document.getElementById('header');
    var headerWidth = getStaticData();
    var headerTime = header.innerHTML.length * 0.3;
    var windowWidth = window.innerWidth;
  
    //clean all
    header.style.transition = 'none';
    header.style.marginLeft = windowWidth + 'px';
  
    alert("baba"); //BAD BOY
  
    //animate text
    header.style.transition = 'margin linear ' + headerTime + 's';
    header.style.marginLeft = '-' + headerWidth + 'px';
  
    //wait and repeat
    var delay = headerTime * 1000 + 1000;
    setTimeout(animation, delay);
  }
  
  //first call
  window.onload = function() {
    setStaticData();
    animation();
  };</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html {
    width: 100%;
    overflow: hidden;
  }
  
  body {
    height: 100%;
    width: 100%;
    position: relative;
    display: block;
    margin: 0;
    padding: 0;
    top: 50vh;
    transform: translateY(-50%);
    color: black;
    background-color: #bbc8d9;
  }
  
  header {
    font-family: calibri, arial;
    font-weight: 400;
    font-size: 100px;
    white-space: nowrap;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="de"&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;link rel="stylesheet" href="style.css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;header id="header"&gt;+++ News, More News, Another Thing &amp; something else +++&lt;/header&gt;
    &lt;script src="functions.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>If I remove the bad boy [alert("baba");] it doesn't work, like I mentioned above.</p>
  
  <p>I going crazy! Can you pls help me?  </p>