Hi, thank you very much for the video. I have a question though, I've always read that there is only a global execution context and a function execution context, but if I understand correctly from your videos, an execution context is created when there is a block of code that contains a let or a const? so the structure of that lexical environment for such a code block would not contain an arguments object, it only contains a reference to the parent lexical environment (called outer) and any let/consts that are defined within it? are function declarations inside such a block also only available in the if block's execution context or does the parent have access to the if block's function declaration?
No. For block scope containing let/const, a new Lexical environment is created, not an Execution context. However, the Lexical Environment functions similar to the Execution context.
what will happen with `a`, `b` and arguments obj if I assign a detail value to parameter on function declaration? example: function sum (a = 6, b =5) { console.log(a+b); }; sum();
And if incase of a and b assigned to sum parents then also a and b will be considered as local memory (6,5) which ever first comes in chain will be considered
@@and.v761 detail value to parameter is like default parameter so it will apply if you don`t pass any parameter time of function call (suppose you assign value of a and b before this function it won`t effect) but in case of if you pass different value in parameter it will use that value var a = 5; // this value won`t be consider by fun function myFunction(a=10, b=a) { // this value will be consider reason it`s in local scope console.log('a = ' + a + '; b = ' + b); } myFunction(); // a=10; b=10 myFunction(22); // a=22; b=22 myFunction(2, 4); // a = 2 b = 4
@@mitesh5189 ok...There are a few things that are not clear. the argument object will record any real values that we pass into funciton. So, why we need declare the 'arg' variable as the video on creation phase?? I things argument object is enough. Get back my example function sum(a, b) { return a+b } sum(2,4) // creation phase: a=2, b=4, argument obj [0: 2, 1: 4] ????
The best explanation I ever found on this topic..!! thank you so much Miss Xing.
You are a fantastic programmer and a great teacher. Thanks to you I finally understood how the execution context works.
great job
hello, do you video about security in spring boot?
Hi, thank you very much for the video. I have a question though,
I've always read that there is only a global execution context and a function execution context, but if I understand correctly from your videos, an execution context is created when there is a block of code that contains a let or a const? so the structure of that lexical environment for such a code block would not contain an arguments object, it only contains a reference to the parent lexical environment (called outer) and any let/consts that are defined within it? are function declarations inside such a block also only available in the if block's execution context or does the parent have access to the if block's function declaration?
Did you find the answer to this question?
No. For block scope containing let/const, a new Lexical environment is created, not an Execution context. However, the Lexical Environment functions similar to the Execution context.
what will happen with `a`, `b` and arguments obj if I assign a detail value to parameter on function declaration?
example:
function sum (a = 6, b =5) {
console.log(a+b);
};
sum();
Then a ans b will be stored in local memory scope because you are assigning that values
And if incase of a and b assigned to sum parents then also a and b will be considered as local memory (6,5) which ever first comes in chain will be considered
@@mitesh5189 so, what are differences between arg variable and argument object. whose value with be used firstly by function?
@@and.v761 detail value to parameter is like default parameter so it will apply if you don`t pass any parameter time of function call (suppose you assign value of a and b before this function it won`t effect) but in case of if you pass different value in parameter it will use that value
var a = 5; // this value won`t be consider by fun
function myFunction(a=10, b=a) { // this value will be consider reason it`s in local scope
console.log('a = ' + a + '; b = ' + b);
}
myFunction(); // a=10; b=10
myFunction(22); // a=22; b=22
myFunction(2, 4); // a = 2 b = 4
@@mitesh5189 ok...There are a few things that are not clear.
the argument object will record any real values that we pass into funciton. So, why we need declare the 'arg' variable as the video on creation phase?? I things argument object is enough. Get back my example
function sum(a, b) {
return a+b
}
sum(2,4) // creation phase: a=2, b=4, argument obj [0: 2, 1: 4] ????
You need time codes
This video is very knowledgeful but your voice is not clear. It seems like u are chewing something, drinking your saliva and tries to explain us.