JSFiddle - React, Tailwind, and code Playground

by Carlos Medina

HTML

<script src="https://code.jquery.com/jquery-2.2.2.js"></script>
<button id="button">Try it</button>

JavaScript

var count = 0;

       $("#button").on("click", function(){
       

         count = count + 1;
         alert(count);  

      if(count == 3){
  //exit the function but it's not doing that and keeps on counting.
       count = 0;
       }
       
       })