Lab

IIFE — Immediately Invoked Function Expression

medium
1/5

Step Explanation

Understand what is happening first

1/5

Execution Visualizer

Watch memory, stack, queues, and output

Execution Visualizer

live
The outer () around the function converts it from a declaration to an expression. Without this, JavaScript would see 'function()' and throw a SyntaxError because anonymous function declarations are not allowed.

Call Stack

1 frame
TOP ↑
main()
frame 0
↓ BOTTOM
Global Context

Memory

1 variable

Stack Memory

resultvarnew
"TDZ"
Console Output

awaiting output...

varfnobjarrclosure

Code Preview

Active line 6

Code

line 6
JavaScript
Tap Expand to view full code

1/5