document.cookie = "cookieName=cookieValue; max-age=-1";
In this code, `cookieName` is the name of the cookie you want to create, and `cookieValue` is the value you want to assign to the cookie.
Once you've set up your cookie, you can access it using the `document.cookie` method and manipulate its value as needed. For example, you could retrieve the value of the cookie like this:
var myCookie = document.cookie.replace(/(?:(?:^|.*;s*)cookieNames*=s*([^;]*).*$)|^.*$/, "$1");
In this code, `myCookie` will contain the value of the `cookieName` cookie.
Just keep in mind that while persistent cookies can be useful for storing user data or preferences, they can also be used for tracking user behavior across multiple sessions. So be sure to use them responsibly and with the user's consent.