This question has already been answered:
There is such code:
var f = function() { this.x = 5; (function() { this.x = 3; })(); console.log(this.x); } Why the function inside the function is written like this:
(function() { this.x = 3; })(); And why can not write like this:
function() { this.x = 3; } ?