Cookies are small data items that consist of a name and a value stored on behalf of web browsers. Cookies can be accessed through the document.cookie object, but the interface provided is very primitive.
The expiry property allows cookies to be able to have an expiration date. Thus, in cookies there is an expiration date that will be saved between browsing sessions and is deleted only when the expiration date is reached, or the user indicates this to the browser. The property value can be either the date on which the cookie expires, or a few seconds after the expiration of the cookie.
Clear Cookies
A cookie can be cleared using the clear function, which takes the cookie name as an argument:
If a cookie has been set for a path or domain other than the current path and domain, they must be passed to the clear function via an optional second parameter:
// clear the site-wide cookie cookies().clear( 'theme', { path : '/', domain : '.example.com' });
source share