Where i am wrong?


#1

er = {
total:0;
add: function(itemCost){
this.total += itemCost;
}
};

cashRegister.add(0.98);
cashRegister.add(1.23);
cashREgister.add(4.99);
cashRegister.add(.45);

//call the add method for our items

//Show the total bill
console.log('Your bill is '+cashRegister.total);


#2

the use of comma's (,) is required to separate member variable and property's:

total:0,

a comma is required after total: 0 instead of a semi-colon

then, make sure your object is called cashRegister and not er

then make sure to spell cashRegister correctly when calling the add method (case-sensitive)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.