想問一條JS array問題
諗左好耐都唔知點寫
話說依家你當有一個array裡面有好多objects,個內容係咁
[{ student: "A", chinese: 50, english: 40},
{ student: "A", chinese: 60, english: 30},
{ student: "B", chinese: 40, english: 30},
{ student: "B", chinese: 50, english: "--"},
]
我期望可以計到每個學生兩科既平均分再出返一個新array:
[{ student: "A", chinese: 55, english: 35},
student: "B", chinese: 45, english 30}]
可以點樣寫
利申非功課,非做野