Created
March 7, 2016 11:01
-
-
Save jbilcke/005d1942737373e6bc82 to your computer and use it in GitHub Desktop.
Calcul du total par personne
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function total(opts){ | |
var plats = opts.plats.reduce((r,p) => r + p) | |
return plats + (opts.livraison / opts.nbPersonnes) - (plats * opts.reduction) | |
} | |
total({ | |
plats: [3.10, 8.20, 0.30], // prix des plats d'une personne | |
livraison: 1.50, // 12h-13h | |
reduction: 0.15, // 15% | |
nbPersonnes: 4 | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment