æ°åã®åãæ±ããããã°ã©ã ãä½æãããã¨ã«ãªããææ°æã ã¨ä»¥ä¸ã®ãããªããã°ã©ã ãæ¸ããã¨ããç¶æ³ãæ³åãã¦ä¸ããã function sum(nums, acc = 0) { if (nums.length === 0) return 0; if (nums.length === 1) return nums[0]; return sum(nums.slice(1), acc + nums[0]); } const nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; console.log(sum(nums)); // expected: 55 ä¸è¦ããã¨ä½ãåé¡ãªãããã«è¦ããããã°ã©ã ã§ãããå®ã¯ãã°ãããã¾ã (çããåããã¾ãã?) *1ãå®éã«ä¸è¨ããã°ã©ã ãå®è¡ãã㨠55 ã§ã¯ãªã 10 ãåºåããã¾ãã ããããå ´é¢ã«ééããã¨ãèªç¶ã¨ sum
{{#tags}}- {{label}}
{{/tags}}