Reputation: 1
I have an array of month & year and i have a start month and year. What i want to do is to filter out the month and year which matched to the start month and year. But for some reason my if loop is not filtering month & year
Code Snippet:
for (let a of data) {
if (start_date_data[0].month && start_date_data[0].year !== a.month && a.year) {}
where am i going wrong ? please help
Upvotes: 0
Views: 22
Reputation: 10969
It should be :-
for (let a of data) {
if (start_date_data[0].month !== a.month && start_date_data[0].year !== a.year) {}
Upvotes: 2