How to remove element from array based on two values?
E.g. element with day: 8, date: august 2021.'
Array:
var events =
[ { day: 8, date: 'july 2021.' }
, { day: 16, date: 'july 2021.' }
, { day: 8, date: 'august 2021.' }
, { day: 16, date: 'august 2021.' }
]
e.g. if I click on day 8, august I want to remove just element
8, august not also 8, july
What I tried:
// number of the day clicked $scope.newEvent (8)
// date of day clicked $scope.selectedDate ("august 2021.")
var newEventsArray = events.filter(e =>
e.day != $scope.newEvent && e.date == $scope.selectedDate)
$scope.newEventand$scope.selectedDate?... != ... || ... != ...(the filter function needs to return true if either one doesn't match)