我有两个由定制对象组成的数组。它们看起来像下面这样:
courses: [
{Course: "Design", ECST: 5},
{Course: "Construction", ECTS: 10}
],
statistics: [
{Course: "Design", Hours: 2},
{Course: "Design", Hours: 2},
{Course: "Construction", Hours: 2},
{Course: "Construction", Hours: 2},
],
我想从每门课程的“统计”数组中计算小时数总和。问题是用户添加了课程,所以我不能说===“设计”,但我必须根据添加的课程来比较它们。所以我的问题是:如何计算“统计”数组中每门课程的总学时数?有没有办法简单地比较已经添加的课程?就像所有课程都彼此相等一样,了解小时数吗?
DIEA
拉风的咖菲猫
相关分类