Javascript Quiz: How well do you know IIFE Function in JS #programming #javascript #coding #quiz



Javascript Quiz: How well do you know IIFE Function in JS #programming #javascript #coding #quiz

Javascript Quiz: How well do you know IIFE Function in JS #programming #javascript #coding #quiz

Are you ready for another code challenge? Join me in this video as you test your coding knowledge with the simple quiz questions.

Don’t forget to make your guess in the comments below.

——————————————————————————————-

🔔Like and subscribe for more videos. 🔔

Connect me on linkedin :
https://www.linkedin.com/in/meenakshilodhirajput/
https://www.linkedin.com/in/rk-barnwal23/
——————————————————————————————

Answer OPTION: A) 10

Explanation:
The code defines a global variable x with a value of 10.

Inside the immediately-invoked function expression (IIFE), a local variable x is defined with a value of 20.

The foo() function is called from within the IIFE.

When foo() is called, it looks for the value of x in its own scope and then in the outer scope, which is the global scope.

So, foo() logs the value of the global variable x, which is 10.

Hence, the output will be 10.