I have a simple object called "obj1".
let obj1 = {
x: 1,
y: 5,
meth: function() {
return `The result of the ${this} is ${this.x+this.y}`;
}
};
in console, it print
The result of the [object Object] is 6;
I want to get the Object
name, which is obj1
but it gives me [object Object]
.
I tried this.name
but it's showing undefined
.