Crunchyroll Interview Question

If you had a nested jQuery function and the second function's "this" scope is independent of the parent function, how would you pass the parent function's "this" to the second function?

Interview Answers

Anonymous

Sep 10, 2014

You make the second function nested by making it a parent of another function (that actually has your code) and the second function now becomes an executable function passing the argument "this" to the parameter which is now in the scope of the third nested function.

Anonymous

Jan 14, 2016

Use parentFuntion() { childFunction.bind(this) }; The above code will let the "this" from the parent function to be available in the child function