So, I'm creating an object with toString method and then call it:
const object = {
toString() {
console.log(this);
},
};
object.toString();
And after I've invoked the method, console recursively logs object then, like this:
script.ts:207 {toString: ƒ}
script.ts:207 {toString: ƒ}
script.ts:207 {toString: ƒ}
It happens only with toString method and when I log object itself.
What's happening here, why it's recursive? Somebody help me please