I have problems with task which looks like pretty simply. I need to match two variables and return true if match and false if not.
I have made method which check it
isAnyApplicationFromToday(): boolean {
this.userApplications.forEach(application => {
if (application.registerDate.toString() == this.today.toString()) {
return true;
}
});
return false;
}
but it always return false.
Funny is that, if I console.log(), variable values match.
I tried already combination:
if (application.registerDate.toString() === this.today.toString())
if (application.registerDate === this.today)
if (application.registerDate == this.today)
any ideas ?
EDIT:
isAnyApplicationFromToday(): boolean {
let isAny = false;
this.userApplications.forEach(application => {
if (application.registerDate.toString() === this.today.toString()) {
isAny = true;
}
});
return isAny;
}
work just fine.