title: setTimeout not being fired
body: <p>I am using Leaflet to add 3 markers on a floor plan. It works fine. then I tried to let Math.random to produce the coordinates in pixels every 3 secs, remove the old marker and add a new marker. But I found the setTimeout() doesn't work. I tried many solutions, all failed. Please could you guide?</p>
  <p>one more question: the control.scale doesn't work either. The scale is still at the bottomleft and ft bar is still there.</p>
  <p>I am using Leaflet to add 3 markers on a floor plan. It works fine. then I tried to let Math.random to produce the coordinates in pixels every 3 secs, remove the old marker and add a new marker. But I found the setTimeout() doesn't work. I tried many solutions, all failed. Please could you guide?</p>
  <p>one more question: the control.scale doesn't work either. The scale is still at the bottomleft and ft bar is still there.</p>
  <pre><code>  &lt;script&gt;
  
      var map = L.map('map', {
      crs: L.CRS.Simple,
      Zoom: 0,
      maxZoom:16,
      minZoom: -5
    });
  
  
  
      var bounds = [[0,0], [1079,2159]];  // [y, x]
      var image = L.imageOverlay('officemap.jpeg', bounds).addTo(map);
  
      map.setView( [539,1075], 0);   // ([y , x] , zoom)
  
      map.fitBounds(bounds);
  
      //L.control.scale('topleft', '50', 'True', 'False', 'True' ).addTo(map); // doesn't work !!!
  
      L.control.scale().addTo(map);
  
  
      var yx = L.latLng;
  
      var xy = function(x, y) {
        if (L.Util.isArray(x)) {    // When doing xy([x, y]);
            return yx(x[1], x[0]);
      }
      return yx(y, x);  // When doing xy(x, y);
    };
  
    function getRandomIntInclusive(min, max) {
      min = Math.ceil(min);
      max = Math.floor(max);
      return Math.floor(Math.random() * (max - min + 1)) + min;  
    }
  
    var sol      = xy(1079, 539);
    //var mizar    = xy(2159, 1079);
    //var mizar    = xy(getRandomIntInclusive(0, 2159), getRandomIntInclusive(0, 1079));
    var kruegerZ = xy(0,  0);
  
    var maker_text=&quot;I am good!!!&quot;;
  
    //var maker_text_array =['Name:', 'Age:', 'Group:'];
  
    L.marker(sol).addTo(map).bindTooltip(      'Sol');
  
  
    L.marker(kruegerZ).addTo(map).bindTooltip(maker_text);
  
    //var previous_maker=null;
    var current_marker=null;
  
    /*
    function sleep(milliseconds) {
        const date = Date.now();
        let currentDate = null;
        do {
         currentDate = Date.now();
          } while (currentDate - date &lt; milliseconds);
       };
  
  */ 
    var i=&quot;100&quot;; 
    var mizar    = xy(getRandomIntInclusive(0, 2159), getRandomIntInclusive(0, 1079));
    current_marker=L.marker(mizar).addTo(map).bindTooltip(i);
  
  
  function del_add(){
  
    alter(&quot;in set&quot;);
    map.removeLayer(current_marker);
    mizar= xy(getRandomIntInclusive(0, 2159), getRandomIntInclusive(0, 1079));
    current_marker=L.marker(mizar).addTo(map).bindTooltip(&quot;I am OK&quot;);
  };
  
  //for(var j=0; j&lt;10; j++){
  
    setTimeout(&quot;del_add()&quot;, 100);
  
  
  //};
  //alert(&quot;done&quot;);
  //  var travel = L.polyline([sol, deneb]).addTo(map);
  
  
  
  
  &lt;/script&gt;
  </code></pre>