// Code Starts
function Person(name) {
this.name = name;
console.log(this.name); //Output 1
console.log(this); //Output 2
}
var p1 = new Person("Object_Shashank");
var p2 = Person("Function_Shashank");
// Code Ends
p1 :
- Output 1: Object_Shashank
- Output 2: Person {name: "Object_Shashank"}
p2 :
- Output 1: Function_Shashank
- Output 2: Window {speechSynthesis: SpeechSynthesis, caches: CacheStorage, localStorage: Storage, sessionStorage: Storage, webkitStorageInfo: DeprecatedStorageInfo…}
Can someone please explain "p2: Output 2"