The correct syntax for creating a new Date object in JavaScript is as follows:

new Date(year, monthIndex, day);

Using this syntax, the correct way to create a new Date object for October 9, 2023 would be:

new Date(2023, 9, 9);

Please note that the monthIndex parameter starts from 0 (January) to 11 (December), so October is represented by 9 in this case.

JavaScript Date Object: Creating a Date for October 9, 2023

原文地址: https://www.cveoy.top/t/topic/o9Qp 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录