Skip to content

Commit d368a7b

Browse files
committed
IIFE
1 parent 29453ab commit d368a7b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

functions/IIFE.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@ test();
1111
console.log("What is IIFE Again?");
1212
})(); // last brackets are to pass argument
1313

14+
(function (name) {
15+
console.log(`Hi There, ${name}`);
16+
})("rakib");
17+
console.log("---------------------");
18+
1419
const sum = (function sum() {
1520
return 10 * 10;
1621
})();
1722
console.log(sum);
1823

24+
(function (x, y) {
25+
console.log(x * y);
26+
})(2, 3);
1927
console.log("---------------------");
2028

2129
const user = (function () {
@@ -29,3 +37,11 @@ const info = (function () {
2937
return `Hello ${user.name}`;
3038
})();
3139
console.log(info);
40+
41+
const myFunction = (function () {
42+
const hi = "Hi!";
43+
return function () {
44+
console.log(hi);
45+
};
46+
})();
47+
myFunction();

0 commit comments

Comments
 (0)