Mémoire immédiate


#1

what's is wrong ?

var caisse = {
total:0,

//N'oubliez pas d'ajouter votre propriété 

ajouter: function(prixElement) {
    this.total += prixElement;
    this.prixDerniereTransaction -= prixElement;
    this.prixDerniereTransaction = prixElement;
},
scan: function(element, quantite) {
    switch (element) {
    case "oeufs": this.ajouter(0.98 * quantite); break;
    case "lait": this.ajouter(1.23 * quantite); break;
    case "magazine": this.ajouter(4.99 * quantite); break;
    case "chocolat": this.ajouter(0.45 * quantite); break;
    }
    return true;
},
//Ajoutez la méthode annuleDerniereTransaction ici 
annuelleDerniereTransaction: function() {  
this.total -= this.prixDerniereTransaction;

},

};

caisse.scan('oeufs', 1);
caisse.scan('lait', 1);
caisse.scan('magazine', 1);
caisse.scan('chocolat', 4)

//Annulez la dernière transaction et ajoutez 3 à la place

caisse.annuelleDerniereTransaction()
caisse.scan('chocolat', 3);

// Affichez le total de la note
console.log('Votre total est de '+ caisse.total);


#2

@esla5,
In your ajouter property
you will have to change

into

    this.prixDerniereTransaction = prixElement;

#3

yes i did still not work


#4

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