title: how can I set a setInterval as a global variable?
body: <p>I just wanna make a button to start adding some text in my body, and a button to stop adding this text.</p>
  <p>I figured out that I can use a setTimeout in a function or a setInterval...but I couldn't Clear both of them because of the local scope...I can't declare both of them as a global scope, I want my button.onclick activate them not by default.</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>/* global document*/
   
        
  var myStart = document.querySelector('#start'),
          myEnd = document.querySelector('#end'),
          myRepeat;
  
  function start() {
      "use strict";
      document.body.innerHTML += '&lt;br&gt;Welcome StackOverFlowMembers!';
      myRepeat = setTimeout(start, 1000)
  }
  
  function stop() {
      "use strict";
      clearTimeout(myRepeat);
  }
  
  myStart.onclick = start;
  myEnd.onclick = stop;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
      &lt;button id="start"&gt;Start!&lt;/button&gt;
      &lt;button id="end"&gt;End!&lt;/button&gt;
      &lt;script src="script.js"&gt;&lt;/script&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>