Lab

var vs let vs const

beginner
1/6

Step Explanation

Understand what is happening first

1/6

Execution Visualizer

Watch memory, stack, queues, and output

Execution Visualizer

live
var is hoisted to the top of its function (or global) scope with value undefined. It can be re-declared and re-assigned anywhere in that scope.

Call Stack

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

Memory

1 variable

Stack Memory

xvarnew
10
Console Output

awaiting output...

varfnobjarrclosure

Code Preview

Active line 1

Code

line 1
JavaScript
Tap Expand to view full code

1/6