If a variable is declared but not initialized , it will print undefined in the console.But in this particular case if i console.log(this.name)
inside Person function it should create a global variable called name
whenever i invoke the function .But the global variable must be undefined, instead it is holding a empty string .I even checked the window object .It has a property called name which holds empty string.Why it is behaving this way ?
function Person(){
console.log(this.name)
}
Person() // should prints undefined ,but prints empty string