1👍
✅
Simply replace function with arrow functions, so sortPosts
will be written in the following syntax:
sortPosts(columnName) {
return this.posts.filter((post) => {
if( columnName == 'Opportunity') {
this.opportunityHeadValues.push({annual_value: post.annual_value});
}
if(post.pipeline_stage == columnName) {
return post;
}
});
}
And another point, filter
expects boolean
to be returned, so it keep all items that return true
and filter out all items that return false
.
I encourage you to check map
and sort
functions.
Source:stackexchange.com