You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// As soon asthe event listener is hit this callback function will come into the callstack and executed
// let suppose you want to track how many times the button is clicked how to do with help of closures + event listeners
// function addEventListeners(){
// let cnt=0;
// $(".btn").click(function(){
// console.log("Button clicked",++cnt," times");
// })
// }
// $(document).ready(function(){
// addEventListeners();
// })
// Why do we need to remove the event listners ?
// Event listeners are heavy as they may form the closures with the lexical scope local variables so their memory is not freed up ie not garbage collected therfore we need to remove them when not in use as they take the extra space