Closure is created when inner functions are able to access the variables of outer function. What closure does is it remembers the state of the function, even after the function as returned. If we have to create a
closure, we have to define a function inside another function and return so, that inner function will be having access to outer function variables.
Lexical environment is a reference to the outer functions scope and is part of the every function execution context.
Unlike a normal function,
this keyword is referencing to. Every function receives two addition parameters excluding declared parameter:
Every function while executing has a reference to its current execution context called “
this". Here execution refers to where the function is getting called and when it will be called. There are four rules for how "this" keyword gets bind. It tells how "this" keyword will get bind for functions. Let's see what are those.
Let's take an…
In my last post, we have discussed all about scope. When we started looking in-depth we thought like how come var doesn’t through error even if its undeclared. So we are going to discuss about hoisting and what actually it is happening.
So let’s take a simple example (here compilation phase means after hoisting)
A variable declared outside a function becomes global. All functions have access to global variables. Declarations, where they are occurred will be processed before any code execution is done and there initial value is. This is called as and we will discuss that as well.
Variables that are available only in a specific part of our code are considered to be in the local scope…
Map uses key value pairs and keeps the original insertion order of the keys. Any value may be used as key.
Properties and Methods of Map (only Size is property)