In the last example, where we change the innerFunction from non-arrow Function to Arrow Function to get the this.name from parent scope, another way to solve that problem would be to use call/apply/bind. For eg. - innerFunc.call(this). Is it worth mentioning this in the interview? wdyt?
Hey Soham, Yeah sure we can tell the interviewer about call bind apply, this would definitely add a good impression. If you wouldn't then you can expect follow up question on call bind and apply.
Also, there is one more way to solve the last question is to, use call, apply, and pass the value of "this" explicitly to the innerFunction. innerFunction.call(this); innerFunction.apply(this);
Great video sir, it helped me in MCQ round today
In the last example, where we change the innerFunction from non-arrow Function to Arrow Function to get the this.name from parent scope, another way to solve that problem would be to use call/apply/bind. For eg. - innerFunc.call(this). Is it worth mentioning this in the interview? wdyt?
Hey Soham, Yeah sure we can tell the interviewer about call bind apply, this would definitely add a good impression. If you wouldn't then you can expect follow up question on call bind and apply.
07:31 Object does not have a scope
Also, there is one more way to solve the last question is to, use call, apply, and pass the value of "this" explicitly to the innerFunction.
innerFunction.call(this);
innerFunction.apply(this);
great !!