Changing the console-visible name of an object in js, via chrome

121 Views Asked by At

When an object is created via the new function(){} method, the object inherits the constructors name:

new function(){this.x=616};         // Object {x: 616}
new function Func(){this.x=616};    // Func {x: 616}

What I want to know is how to change the objects visible-name once constructed... I've tried re-naming the object via the constructor:

[object].__proto__.constructor.name=[new name]; // Func {x: 616}

I've even tried re-defining the constructor itself:

Object.defineProperty([object].__proto__,'constructor',{
    value:function [new name](){},
    configurable:true
});

// Func {x: 616}

But the objects visible-name remains the same, and that is the extent of my knowledge on this topic! All help greatly appreciated as always guys. Thx...

0

There are 0 best solutions below