Рет қаралды 11,742
Hi Everyone
Closures are one of the important concept in Javascript and one of the asked Interview Question during technical discussion. Closures are must to learn concept if you are preparing for your javascript interview or working as senior developer as it will help you to write more organised code.
Watch the complete video till the end to understand it completely.
Along with Closures, we have also talk about lexical scope, scope and IIFE functions in javascript.
What is Lexical Scope?
A lexical scope in JavaScript means that a variable defined outside a function can be accessible inside another function defined after the variable declaration. But the opposite is not true; the variables defined inside a function will not be accessible outside that function.
What is Closures
In JavaScript, a closure is a function that references variables in the outer scope from its inner scope.
The closure preserves the outer scope inside its inner scope even after outer function is returned.
What is IIFE?
An IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined.
It is a design pattern which is also known as a Self-Executing Anonymous Function
Check another important interview Question
• Frontend Interview Que...
Check video on Recursion
• What is Recursion | Ja...
Support my channel by liking and sharing my videos so that I can reach to wider audience. Please share it in your network 🙏
Connect with me on social platform:
Facebook: / angularjs4beginners
LinkedIn: / nisha-singla-82407aa0
Instagram : / nishasingla05
Twitter: / nishasingla05
For more such interesting videos, please subscribe to my channel and stay connected.
#Closures #frontEndInterview #JavascriptInterview