I have a var called testItem and want to add to the 'amount' inside it. I've set up a function so if you pass through the id and amount it should pick up on which variable you're referring to, except it doesn't work:
function addItem(id, count){
id.amount = id.amount + count;
}
var testItem = {
amount: 0,
};
addItem("testItem",100);
alert(testItem.amount);
How do I refer to testItem.amount by using the 'id' parameter? Thanks