hello everyone want to understand the order of javascript code my code
class User {
constructor(id, username) {
this.i = id;
this.u = username;
}
sayHello() {
return `Hello ${this.u}`;
}
}
let userOne = new User(100, "Elzero");
console.log(userOne);
User.prototype.sayWelcome = function () {
return `Welcome ${this.u}`;
};
Object.prototype.test = "Test";
result in console line 12
User {i: 100, u: 'Elzero'}
i: 100
u: "Elzero"
[[Prototype]]: Object
sayWelcome: ƒ () **<-------------**
constructor: class User
sayHello: ƒ sayHello()
[[Prototype]]: Object
test: "Test" **<-------------**
constructor: ƒ Object()
hasOwnProperty: ƒ hasOwnProperty()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toLocaleString: ƒ toLocaleString()
toString: ƒ toString()
valueOf: ƒ valueOf()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
__proto__: (...)
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
can some one tell why in line 12 when i display the userone instance of User i find sayWelcome() method and test property in the prottotype of the userone despite both of them are added after the line 12
Cordially