Skip to content

Commit 0bef03d

Browse files
authored
Update README.md
1 parent 0a56d86 commit 0bef03d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,19 @@ The core principle of a closure still appies here. We've got a function declared
146146

147147
When we declare myBar to be the result of bar(), myBar becomes a function which has access to the scope that it was declared in and therefore has access to foo. Variable foo cannot be safely destroyed by the garbage collector in JavaScript because it's still needed by myBar. What would happen if myBar() were called and the variable foo no longer existed? For this reason foo is kept alive.
148148

149-
### An IIFE. A whaty???
149+
### Form 2: An IIFE (pronounced: iffy). A whaty???
150+
The acronym IIFE stands for Immediately Invoked Function Expression. The examples below are equivalent. The only difference is that example two requires less syntax.
151+
152+
```javascript
153+
function foo(){
154+
return "bar"
155+
}
156+
foo(); // "bar"
157+
```
158+
159+
```javascript
160+
(function {
161+
return "bar"
162+
})(); // "bar"
163+
```
150164

0 commit comments

Comments
 (0)