1👍
✅
You need to drop the this.
when referencing groupID
and homeGroups
as they are not member variables. You can learn more about this
here.
Your code will end up looking like this.
compare: function(groupId, homeGroups) {
groupId.forEach((e1)=>homeGroups.foreach((e2)=>{
if(e1 === e2){
this.sameId.push(e1)
}
}
));
}
Source:stackexchange.com