Clear timeout in JavaScript
October 28, 2014
Clear previous timeouts before creating new ones:
js
// inside a function
if (this.existingTimeout) clearTimeout(this.existingTimeout);
this.existingTimeout = setTimeout(function() {
console.log('Hello');
});