title: no repeat calling Javascript
body: <p>How can I make my function not to repeat the multiple calls, if multiple calls were made in mins? </p>
  
  <pre><code>var s = 1; 
  function foo(x) {
    if (s === 1) {
      console.log('done');
      setTimeout(function(){
        s =1; 
      }, 10000);
    } else {
      s = 2; 
      console.log('no more repeat calling');
  
    }
  }
  
  foo(1); 
  foo(2);
  </code></pre>
  
  <p>I am expecting the result - </p>
  
  <pre><code>done 
  no more repeat calling
  </code></pre>