I have a reference to an object property in a variable, is it possible to access the object to which this property belongs?
var obj = { p1: 1, p2: function(){ return this; }, p3: obj, p4: function() { return obj; } } // v1 is now integer, we cannot get actual `obj` from this `v1` var v1 = obj.p1; // `v2()` returns `window` object (or current context object), // so if `obj` is created only in global context (or current // context which you're calling `v2()`), you can get reference to `obj` var v2 = obj.p2; // as @Ignacio mentioned, you can use `v3` as reference to `obj` var v3 = obj.p3; // `v4()` also reference to `obj` var v4 = obj.p4;
Unless the property value contains an object reference.
Source: https://habr.com/ru/post/1481499/More articles:GMSMarker not showing up in 1.3 - iosContinue to reload the page until the installed text appears (javascript - for greasekit) - javascriptConfusion over the differences between hashmap and hashtable - c ++MultiTouch androidHow to pack the Javascript client library today? - javascriptUnable to create new project in android studio - androidCentOS 6 - libstdc ++ no such file or directory? - c ++Ada for "S" must be a variable - adaHow to get gridview column value in codebehind - c #https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1481504/logical-or-in-doctrine2-getrepository-findby&usg=ALkJrhhKoEFnbMcg7paoT0sLlytaF7VcbgAll Articles