When I run this IIFE function in the console or using it in document, it doesn't work, per definition it's immediately invoked, so why it's not showing anything on the console?
(function(){
console.log(8);
});
When I run this IIFE function in the console or using it in document, it doesn't work, per definition it's immediately invoked, so why it's not showing anything on the console?
(function(){
console.log(8);
});
You missed the execution part.
(function(){
console.log(8);
})(); // () needs to be added