title: Avoid race condition in javascript (while using settimeout)
body: <p>I have a JS function which gets called when a button is clicked. The same function gets called after a timeout too (using setTimeout). How can I avoid a race condition when somebody clicks the button and setTimout gets called at the same time ?</p>