Skip to content

Commit b61b4af

Browse files
feat: add IIFE
1 parent 3e27d18 commit b61b4af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
INFO: ⚡ What is an IIFE ?
3+
IIFE Stands for (Immediately Invoked Function Expression). It's a function that executes immediately after it's defined, without needing to be called later.
4+
*/
5+
6+
// Syntax
7+
(function() {
8+
console.log("I run immediately!");
9+
})();
10+
11+
// Example
12+
(function() {
13+
const message = "Hello from IIFE!";
14+
console.log(message);
15+
})();
16+
// console.log(message); // ❌ Error: message is not defined
17+

0 commit comments

Comments
 (0)