imagine I have an object
teaherList = [
{teacherID:1,teacherName:"john"},
{teacherID:2,teacherName:"joe"},
{teacherID:3,teacherName:"jill"},
{teacherID:1,teacherName:"john"},
{teacherID:2,teacherName:"joe"},
{teacherID:3,teacherName:"jill"},
{teacherID:1,teacherName:"john"},
{teacherID:2,teacherName:"joe"},
{teacherID:3,teacherName:"jill"},
]
now how do i find the frequency of each [teacherID:,teacherName:], in the object teaherList
currently how I am doing is,
let temp = []
_.each(teaherList, function(k){
temp.push(k.teacherID)
)
let count1 = countBy(temp);
well it is giving the frequency of the occurrence of the teachers in the object but is there a better and performant way to do this task