While studying the closers topic I stack up with one simple question.
For example these code work:
!function (){
console.log(true)
}();
(function (){
console.log(true)
})(); // doesn't work when 'use strict' is defined
var varName = function (){
console.log(true)
}();
These code doesn't work:
function (){
console.log(true)
}();
function funcName (){
console.log(true)
}();
Question:
What is this simple rule that stand by behind the self-invoking functions? Or they simple need to have their own lexical environment and cant exist as general object?