Skip to content

Commit bc467bf

Browse files
committed
IMMEDIATELY INVOKED FUNCTION EXPRESSIONS (IIFE)
1 parent 47c1889 commit bc467bf

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

03_basics/04_iife.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Immediately Invoked Function Expressions (IIFE) => ()()
2+
//IIFE => those functions who executes immediately and sometimes global scopes ke variables se problem hoti hai to global scope ke pollution se htane ke liye IIFE ka use hota hai
3+
// 2 IIFE ek sath ; se likhte hai
4+
(function chai(){
5+
console.log(`DB CONNECTED`);
6+
})();//DB CONNECTED
7+
//chai()//DB CONNECTED
8+
( function aurcode() {
9+
console.log(`DB CONECTED TWO`);
10+
})();//DB CONECTED TWO
11+
12+
( () => {
13+
console.log(`DB CONNECTED THREE`);
14+
})();//DB CONNECTED THREE
15+
16+
( (name) => {
17+
console.log(`DB CONNECTED FIVE ${name}`);
18+
}) ('Kalpjeet'); //DB CONNECTED FIVE Kalpjeet
19+

0 commit comments

Comments
 (0)