What's the value of this in the following javascript code? [duplicate]

Clash Royale CLAN TAG#URR8PPP
What's the value of this in the following javascript code? [duplicate]
This question already has an answer here:
Can someone tell me the value of this in the following code when it it invoked like this: new Foo();
new Foo(); // this == window, false
new Foo(); // this == Foo, /false
function Foo()
alert(this == ?);
;
I understand when it is invoked like this: Foo() // this is equals window
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
new Foo()
this instanceof Foo === true
this is an instance of the Foo Class, created with the new keyword.– Luca Kiebel
3 mins ago
this
Foo
new
It's an
Object.create(Foo.prototype) object– Bergi
55 secs ago
Object.create(Foo.prototype)
In
new Foo(),this instanceof Foo === true– Niet the Dark Absol
3 mins ago