I want do declare a variable inside an object using a function that is being declared in that same object. But when I try I get an error:
const obj = {
alpha: 4,
somestuff: function()
{
return 120;
},
// Does not work
beta: this.somestuff()
// Does not work
};
// Works
obj.beta = obj.somestuff();
console.log(obj.beta);
// Works
How can I make it work when object is being declared, not after it was declared