120 likes | 136 Views
This video on "JavaScript Closures" includes the basic topics like variable scopes and scope chains. It also helps you understand what closures are and how functions can access variables that are not local to them. <br><br>This JavaScript Certification course helps you master the JavaScript programming language in an all-inclusive training program that includes complete JavaScript fundamentals, jQuery, Ajax, and more. You will apply your skills by building a real-time chat application.<br><br>JavaScript Course Overview:<br>This training program entails the fundamentals of JavaScript, including the enumeration and elaboration of various data types in JavaScript, an explanation of loops and conditional statements in JavaScript, and an overview of the concepts of objects and variables in JavaScript.<br><br>JavaScript Certification Key Features<br>1. 100% Money Back Guarantee<br>2. 7 complete JavaScript courses<br>3. Covers Ajax, jQuery, and node.js<br>4. Build a real-time chat application<br>5. Course completion certificate<br><br>ud83dudc49Learn more at: https://bit.ly/2SDfYlR
E N D
Variable Scope Global Local Any variable declared within a function is only accessible from that function and any nested functions Any variable declared outside of a function belongs to the global scope, and is therefore accessible from anywhere in your code
Variable Scope Global Local Any variable declared within a function is only accessible from that function and any nested functions Any variable declared outside of a function belongs to the global scope, and is therefore accessible from anywhere in your code
Variable Scope Global Local Any variable declared within a function is only accessible from that function and any nested functions Any variable declared outside of a function belongs to the global scope, and is therefore accessible from anywhere in your code
What Is a Closure? Closures in JavaScript is a feature where an inner function has access to the outer function’s variables A closure has three scope chains –
What Is a Closure? Closures in JavaScript is a feature where an inner function has access to the outer function’s variables Scope chain is a stack consisting of all the references to the variables for the function being executed A closure has three scope chains –
What Is a Closure? Closures in JavaScript is a feature where an inner function has access to the outer function’s variables A closure has three scope chains – Has access to its own scope, i.e., the variable defined within its curly braces Has access to the variables of the outer functions Has access to the global variables
What Is a Closure? Closures in JavaScript is a feature where an inner function has access to the outer function’s variables
What Is a Closure? Closures in JavaScript is a feature where an inner function has access to the other function’s variables
What Is a Closure? Closures in JavaScript is a feature where an inner function has access to the other function’s variables The inner function inner_func() can access its variable ‘a’ and the outer variable ‘b’