To delete a cookie, you return to the cookie and then specify an expiry date for it. After which, the browser will delete the cookie and no longer send it to the server on every request.
Here's how to implement that in code:
document.cookie = "myFirstCookie=good;"document.cookie = "mySecondCookie=great;"console.log(document.cookie);document.cookie = "mySecondCookie=; expires=Thu, 01 Jan 1970 00:00:00 GMT";console.log(document.cookie);
1 January 1970 00:00:00 is as far back in time as we can go, as JavaScript follows Unix's timestamp. The output for the preceding code is as follows: