I'm wondering whether there is a way to access the name of an object within the object itself.
let object = {a: {test: ()=>{ console.log(?); }}}
object.a.test() // should give me 'a'
In this example I would like to print the name of the object ('a'
) in the console.log
call.