My current method is first of all inefficient.
I’m trying to change this to YYYY/MM/DD format.
date = new Date('January 23, 2021');
Is supposed to return ‘2021-01-23’
Where I’m stuck at in my code is that this if statement keeps passing when its supposed to fail.
if (var.toString().includes('-')) {
} else if (var.toString().includes('January')){
return var;
}
I didn’t fill in the code but the issue is that the program passes the .includes(‘-‘) part of the if statement and I don’t know why it does.