I'm working on Javascript and want to pass a object path to the function and update the object. Why would the object not be updated? and is there a slick way of getting it to work besides returning, or besides passing the entire object to the function and specify the path inside? thx
var stock={
    basket:{
        apple:3,
        orange:2
    },
    table:{
        apple:5,
        orange:5
    }
};
function change(path, amount){
    path+=amount;
}
// calling function
change (stock.table.apple,-2);
console.log(stock.table.apple);
 
     
     
     
    