var cashRegister = { total:0, add: function(itemCost){ this.total += itemCost; } }; var eggs = 0.98; var milk = 1.23; var magazine = 4.99; var chocolate = 0.45; var list = [eggs, milk, magazine, chocolate]; //call the add method for our items for (i = 0; i < list.length; i++) { cashRegister.add (list[i]); } //Show the total bill console.log('Your bill is '+cashRegister.total);