Is there any way to capture the whole function closure and then refer to it in other places of code? I want to do something like that:
var captured_closure;
function anything() {
var x = 10;
var y = "k";
captured_closure = current_function_closure;
}
anything();
console.log(captured_closure.x); //Should be 10
console.log(captured_closure.y); //Should be k
May goal is to export all variables processed by a particular function (I may do it one-by-one but it would be more convenient to have them all) and then to manipulate them in developer tools for debugging purposes. Thank you.
[edit] Sorry, I missed vars inside the function previously. It's corrected now.