Closure – II
Let us see another famous and good example for understanding the concept of closure. A prior knowledge of how callbacks and event loop work in JavaScript is required. setTimeout is not a native function in JavaScript. It is an API similar to XMLHttpRequest which enables us to extend JavaScript to asynchronous in nature. setTimeout is a