The setDate()
method sets the day of a date object (1-31):
Example
const d = new Date();
d.setDate(15);
d.setDate(15);
The setDate()
method can also be used to add days to a date:
Example
const d = new Date();
d.setDate(d.getDate() + 50);
d.setDate(d.getDate() + 50);
Practice Excercise Practice now