I wanna to change object’s property via method called this code:
MAP = MAP || {
level: 0
updateProperty(property, value){
if (this.hasOwnProperty(property){
this.property = value
}
}
}
but when I fire this code I create new property named ‘property’ in my object. But I wanna treat ‘property’ as variable, not as new property!
You probably want this (square brackets
this[property] = value;)