I'm working with an array structured like this:
var data = [
{
student: "sam",
English: 80,
Std: 8
},
{
student: "sam",
Maths: 80,
Std: 8
},
{
student: "john",
English: 80,
Std: 8
},
{
student: "john",
Maths: 80,
Std: 8
}
];
My goal is to calculate the total marks for a specific student, regardless of subject (in this case, student 'sam').
To achieve this, I plan to filter the data array by student name and then iterate through the filtered data entries to calculate the total marks for that student.
I am wondering if there is a groupBy function available in TypeScript similar to SQL that could simplify this task.