Created
March 3, 2019 15:33
-
-
Save BolajiAyodeji/71fa5e08d7b2d90a8b6f428e23147633 to your computer and use it in GitHub Desktop.
The rest operator
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 sum(discount, ...prices) { | |
const total = prices.reduce((a, b) => a + b); | |
return total * (1 - discount); | |
} | |
console.log(sum(0.1, 20, 30, 1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment