let obj ={
algebra: [3, 4, 5, 3, 4, 5],
geometry: [4, 5, 4, 3, 5],
physics: [5, 4, 3, 5, 4, 4],
}
for (let key in obj) {
console.log(key, obj[key].reduce((a,b) => a+b)/obj[key].length)
}
// -> "algebra", 4
// -> "geometry", 4.2
// -> "physics", 4.166666666666667