The setDate() and getDate() methods of the Date object can be used to increment or decrement days from a date in JavaScript.

The following example demonstrates how you can add 7 days to the current date:

const today = new Date()
const nextWeek = new Date()

// Add 7 Days
nextWeek.setDate(today.getDate() + 7)

You can also update the existing JavaScript Date object as shown below:

const date = new Date()
date.setDate(date.getDate() + 7)

To subtract days from a date in JavaScript, simply minus the number of days when updating date with the setDate() method:

const today = new Date()
const lastWeek = new Date()

// Minus 7 Days
lastWeek.setDate(today.getDate() - 7)

Finally, if you are frequently manipulating dates in JavaScript, just add a function to Date’s prototype and call it directly whenever you want to add or subtract days:

Date.prototype.addDays = function (days) {
    const date = new Date(this.valueOf())
    date.setDate(date.getDate() + days)
    return date
}

// Add 7 Days
const nextWeek = new Date(2021, 9, 7)

console.log(nextWeek.addDays(7))
// Thu Oct 14 2021 00:00:00 GMT+0500 (Pakistan Standard Time)

// Minus 7 Days
const lastWeek = new Date(2021, 9, 7)

console.log(lastWeek.addDays(-7))
// Thu Sep 30 2021 00:00:00 GMT+0500 (Pakistan Standard Time)