I have an object like:
var Magic = {
value: undefined,
setValue: function (value) {
this.value = value
return this.value
},
one: this.value
};
and after I ran the following code:
console.log(Magic.setValue(1)) // 1
console.log(Magic.value) // 1
console.log(Magic.one) // undefined
Look at here: Magic.value === 1 but Magic.one === undefined, since I assign one:this.value.
So why would this happen? Where did this on one:this.value point to? How can I assign one property with the value of property value?