Its value depends on how the function is called (e.g., in a method, a regular function, or as a constructor).
Holds callbacks from setTimeout , setInterval , and setImmediate . happy rawat javascript interview questions pdf free best
function createCounter() let count = 0; // Private variable return increment: function() count++; return count; , decrement: function() count--; return count; ; const counter = createCounter(); console.log(counter.increment()); // 1 console.log(counter.increment()); // 2 // count cannot be accessed or modified from the outside directly Use code with caution. 4. Fix the famous setTimeout in a for loop issue Its value depends on how the function is called (e