Q: Javascript add objects in a loop Hi i want to know how you add all the values together in an object using for loop
var myBills = {
    myMumAndDad: 1000,
    myFamily: 2500,
    myPhone: 550,
    myTrain: 650,
    myTraining: 200,
    myInternet: 200,
    myAdobe: 200,
    myElectric: 400,
    myWeb: 100,
    myEditor: 100,
    myRent: 3000,
    myFood: 2000,
};

// Få lavet et loop til at + disse sammen
var allBills = myBills.myMumAndDad + myBills.myFamily + myBills.myPhone + myBills.myTrain + myBills.myTraining + myBills.myInternet + myBills.myAdobe + myBills.myElectric + myBills.myEditor + myBills.myWeb + myBills.myRent + myBills.myFood;


A: var sum = 0;
for(var key in myBills){
    sum += myBills[key];
}

