What will be the output for below in the browser?
@Lakshya Thakur
"use strict";
let foo = {
barX: function () {
console.log(this);
},
barY: () => {
console.log(this);
},
};
let barX = foo.barX;
let barY = foo.barY;
foo.barX(); // Output1?
foo.barY(); // Output2?
barX(); // Output3?
barY(); // Output4?
Option 1
foo window window window
Option 2
foo window window undefined
Option 3
foo window undefined undefined
Option 4
foo window undefined window