I have following script
<script>
var Obj = {
purpose_1: {
defaults: {
purpose:{ my_variable:"Test" }
},
activity: function() {
console.log( Obj.purpose_1.defaults.purpose.my_variable );
}
},
purpose_2: {
}
}
Obj.purpose_1.activity();
</script>
I am accessing my_variable and getting output Test in console from line
console.log( Obj.purpose_1.defaults.purpose.my_variable );
Is there any short cut way like
this.my_variable
to access my_variable instead of this long path
Obj.purpose_1.defaults.purpose.my_variable
Thanks.
this.defaults.purpose.my_variableis one of themthis.defaults.purpose.my_variablewould work as long as you continue to call the function the way you currently do.