teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

再調整

2019/04/19 08:51

投稿

yambejp
yambejp

スコア117902

answer CHANGED
@@ -3,6 +3,7 @@
3
3
  <script>
4
4
  'use strict'
5
5
  window.addEventListener('DOMContentLoaded',()=>{
6
+ const Average=score=>score.reduce((x,y)=>parseInt(x)+parseInt(y))/score.length;
6
7
  const score=["65", "70", "85", "90", "50", "62", "76", "88", "64", "45"];
7
8
  const fLength=score.length;
8
9
  const display=document.querySelector("#display");
@@ -14,9 +15,6 @@
14
15
  return li;
15
16
  }));
16
17
  display.appendChild(ul);
17
- function Average(score){
18
- return score.reduce((x,y)=>parseInt(x)+parseInt(y))/score.length;
19
- }
20
18
  console.log("The average score is:" + Average(score));
21
19
  });
22
20
  </script>