What is the output of the following code snippet? | JavaScript Bind Output Based Questions
@Yomesh Gupta
var foo = 1;
var change = () => {
this.foo = 2;
console.log(this.foo);
};
var obj = {
foo: 3
};
var bounded = change.bind(obj);
// What would be the output of the following?
console.log(foo);
console.log(change());
console.log(foo);
console.log(obj.foo);
console.log(bounded());
Option 1
1 2 2 3 2
Option 2
1 2 1 3 3
Option 3
1 2 2 2 3
Option 4
1 1 2 3 1