Sets the month (0-11) for a specified date.
Syntax
date.setMonth(month)Example
Enter values below to update the example in real time.
const→new→setMonth→December→indexed→console→getMonth→const date = new Date();
date.setMonth(11); // December (0-indexed)
console.log(date.getMonth()); // 11