If I create an Object as follows:
window.Something = {
X: function() {
// statements...
}
};
What is the best way to access this object without using this
?
Example:
If I call the X
property by using:
window.addEventListener("DOMContentLoaded", window.Something.X);
In this case using this
will access window and not Something
.
I thought at this method but I think it is a bad practice.
window.Something = {
X: function() {
var This = window.Something;
// statements...
}
};
There is an implicit way to always access the real
object that created the property?