Created
August 5, 2022 09:11
-
-
Save wentout/5dcdd34f926460d89c8c1552d1bbc3d7 to your computer and use it in GitHub Desktop.
Naming Convention Disambiguation on ChromeDevTools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Author
wentout
commented
Aug 5, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment