I have an object that has numbers as the keys.
item:{
1:'test 1'
2:'test 2'
3:'test 3'
}
The object is generated automatically so the keys are not always the same. So in my method, I pass in the key as a string (ex:'1') and the changed value like so:
function changeValues(key,value){
this.item[key] = value
}
For some reason, this doesn't change my data but instead if I do this, it works perfectly fine.
function changeValues(key,value){
this.item['1'] = value
}
Is there a reason for this behavior and is there anyway to fix it so I can use dynamic property names?