I have the code snippet like this:
function Person(myName,myAge) {
this.name = myName
this.age = myAge
}
Person.prototype = {
say:function() {
console.log("Hi");
}
}
let person = new Person("John",12);
console.log(Person.prototype)
console.log(Person.prototype.constructor)
console.log(person.__proto__)
I can't understand why when I first execute the code(by right click and open the file in chrome),the devtool will log:
Object
ƒ Object() { [native code] }
Object
But when I refresh the browser,the devtool will log:
{say: ƒ}
ƒ Object() { [native code] }
{say: ƒ}
So, in the first log,it actually didn't log the complete object,right?It just log Object
in order to tell you that it is an object instead of telling you the content of this object.Why?What does the browser do when I refresh it?