const date = new Date();
const [month, day, year] = [date.getMonth(), date.getDate(), date.getFullYear()];
console.log(month, day, year);
The console is showing one day previous date of mine. Is this the mistake of VS code ?
day == date.getDate()
but
realMonth != month == date.getMonth()
because month number is given between 0 and 11.