diff --git a/exercises/baby_steps/solution/solution.js b/exercises/baby_steps/solution/solution.js index 2c5b8396..2cb48bc8 100644 --- a/exercises/baby_steps/solution/solution.js +++ b/exercises/baby_steps/solution/solution.js @@ -1,9 +1,7 @@ 'use strict' -let result = 0 - -for (let i = 2; i < process.argv.length; i++) { - result += Number(process.argv[i]) -} - -console.log(result) +console.log( + process.argv.slice(2).reduce( + (x, y) => x + Number(y), 0 + ) +);