JS noob here. If I have a string, how can I call an attribute from an object which has the same name as the string?
var carrot = {
    'vitaminA': 150,
    'vitaminC': 100
};
var cucumber = {
    'vitaminA': 10,
    'vitaminC': 12
};
var vegetable = 'cucumber'
alert(vegetable.vitaminC) // this doesn't work 
Note: this is a simplified version of the problem I'm working on, so I can't simply say alert(cucumber.vitaminC) -- I have to operate on the object based on the string
 
     
     
    