Skip to content

Instantly share code, notes, and snippets.

@SmolinPavel
Created May 21, 2021 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SmolinPavel/95e791ef41c82c417ae14ffa46c6f9f2 to your computer and use it in GitHub Desktop.
Save SmolinPavel/95e791ef41c82c417ae14ffa46c6f9f2 to your computer and use it in GitHub Desktop.
Closure task. What will be the output?
var length = 10;
function fn() {
console.log(this.length);
}
var obj = {
length: 5,
method: function (fn) {
fn();
arguments[0]();
},
};
obj.method(fn, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment