Lv.1数値なしを追加


🤖質問する


👍🏻 2022年1月21日
<script>
  function solution(numbers) {
      var answer = -1;

      let totalNumbers = [0,1,2,3,4,5,6,7,8,9];
      const reducer = (acc, val) => acc + val;
      let totalSum = totalNumbers.reduce(reducer);
      let inputSum = numbers.reduce(reducer);

      answer = totalSum - inputSum;

      return answer;
  }
</script>