Calling an object method from an object property definition
- by Ian
I am trying to call an object method from an object (the same object) property definition to no avail.
var objectName = {
method : function() {
return "boop";
},
property : this.method()
};
In this example I want to assign the return value of objectName.method ("boop") to objectName.property.
I have tried objectName.method(), method(), window.objectName.method(), along with the bracket notation variants of all those as well, ex. this["method"], with no luck.