Skip to content

Instantly share code, notes, and snippets.

@wentout
Created August 5, 2022 09:11
Show Gist options
  • Save wentout/5dcdd34f926460d89c8c1552d1bbc3d7 to your computer and use it in GitHub Desktop.
Save wentout/5dcdd34f926460d89c8c1552d1bbc3d7 to your computer and use it in GitHub Desktop.
Naming Convention Disambiguation on ChromeDevTools
const MethodName = 'MyMethodName';
var NamingObject = {
[MethodName]: function () {
this;
console.log(this.constructor.name); // MyMethodName
debugger;
}
};
debugger;
const zzz = NamingObject[MethodName];
console.log('zzz: ', zzz.name); // MyMethodName
const sss = new zzz();
const xxx = new NamingObject[MethodName]();
// both lines below will use
// 'MyMethodName' as an ouput for Console
// but using Chrome DevTools it will instead
// bring NamingObject as a referer
console.log(sss);
console.log(xxx);
// and using Firefox we will see just Object here
// using just Object keeps less disambiguation
debugger;
@wentout
Copy link
Author

wentout commented Aug 5, 2022

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment