JavaScript Professional — Medium
Key points
- The inner function creates a new variable x that shadows the outer function's x.
- The console.log inside inner() prints the inner x value of 2.
- The console.log outside inner() prints the outer x value of 1.
Ready to go further?
Related questions
