What is the value of 'this' inside an IIFE in non-strict mode?
(function() {
console.log(this);
})();
In non-strict mode, the value of 'this' inside an IIFE is the global object (window in browsers, global in Node.js). This follows the standard rules for 'this' in JavaScript: when a function is called without any context (not as a method, not with call/apply/bind), 'this' defaults to the global object in non-strict mode. This behavior can sometimes be surprising, and it's one of the reasons why many developers prefer to use strict mode ('use strict'), where 'this' would be undefined in this case. Understanding the behavior of 'this' in different contexts is crucial for writing correct JavaScript code, especially when dealing with callbacks and event handlers.