0

console.log(this) in global context and inside a normal function should result in a "Window" object in the console, according to the resource that I was going through.

I get "Window" object in console when I do console.log(this), outside a function, but when I do,

function value() {
console.log(this);
}

value();

I get undefined printed in the console. Can someone explain, why is that?

Bala
  • 1
  • 1

0 Answers0