Skip to content Skip to sidebar Skip to footer

Array.filter() Not Working Properly In Vue.js

Hi i'm struggling with this filter not working: export default { props: { participants: Array, }, methods: { filterUsersByCostCenter() { this.participants.filte

Solution 1:

filter doesn't mutate the array, it returns a new one. You probably need to

this.participants = this.participants.filter(function (participant) {
  return (participant.cost_center == 2);
});

Post a Comment for "Array.filter() Not Working Properly In Vue.js"