In this article we will see how to delete a cookie in JavaScript.
Knowing the name of the cookie, we can write a function that sets its expiration date in the past so that browsers are forced to no longer consider it valid.
'use strict';
const removeCookie = (name = '', path = '/') => {
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=${path}`;
};