I'm trying to create a getter on the following:
function Field(val){
this.value = {};
}
Field.prototype = {
get value(){
return this._value;
},
set value(val){
this._value = val;
}
};
But what I was able to achieve is a getter for field.value
I want to achieve something like this:
field.value.foo['20'] = 'some_value'; // ==> Setter
field.value.foo['20']; // 'some_value' ==> Getter
But I was not able to achieve this, using the above code .. Can someone help ..