title: javascript differentiate between click and double click
body: <p>I have a simple program like:</p>
  
  <pre><code>&lt;div onclick="handleClick(event)" ondblclick="handleDoubleClick(event)"&gt;
    Hellooww world
  &lt;/div&gt;
  &lt;script&gt;
      var a = false
      function handleClick(e) {
      if(a) {
          a = false
              console.log("Hellooww", a)
      }else{
          a = true
        console.log("Hellooww", a)
      }
      }
  
    function handleDoubleClick(e) {
      console.log("world")
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>Here on single click it sets the value of a to true of false.. But when its double click it perfomrs both single click and double click</p>
  
  <p>How can I check only for single click and double click</p>