I stumbled on a weird scenario where the context this of an instantiated function inside the constructor is different. Any explanation for this behaviour will be greatly helpful.
function Parent() {
console.log(this); // Parent {}
function Child() {
console.log(this); // Window
}
Child();
}
var p = new Parent();
// Imagine calling the afore-mentioned function within browser globals.
Couldn't grasp the above output why Child function is still pointing to Window instead of Parent. What am i missing here?