Last active
June 28, 2020 14:58
-
-
Save jeremymouzin/565179f4e313f3eb72b8868254d1f19a to your computer and use it in GitHub Desktop.
Challenge 1 du Challenge JavaScript 10 jours de Scrimba
This file contains hidden or 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
| // Version lisible pour débutants | |
| function add(...nombres) { | |
| let somme = 0; | |
| for (nombre of nombres) { | |
| somme = somme + nombre; | |
| } | |
| return somme; | |
| } | |
| // Version avancée plus compacte | |
| function add(...nombres) { | |
| return nombres.reduce((somme, nombre) => somme += nombre, 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're welcome.