How can I retrieve an object child using other variable.
The Code
var product = {
'123':{
'name':'Basket',
'price':'12.30'
}
}
var id = 123;
var basket_price = product.id.price; // I want to use the id value
// as the reference to
// retrieve the object child
How is the correct way to achieve that? Apparently the above way is unsuccessful because I don't specify any child with the key name of 'id' in the object definition.