I'm facing a problem checking whether a date is in my array or not.
I refer to this article How to correctly use JavaScript indexOf in a date array
But when I use it in my project, it always results in -1.
Here's my code
for (var current = dateStart; current <= dateEnd; current.setDate(current.getDate() + 1)) {
console.log(this.leaveState.currentHoliday.map(Number).indexOf(+current));
}
I need to check whether current
date is in currentHoliday
array or not.