Cookies

console.log(document.cookie); // cookie1=value1; cookie2=value2;...
document.cookie = "user=John"; // update only cookie named 'user'
alert(document.cookie); // show all cookies
// special values, need encoding
let name = "my name";
let value = "John Smith"

// encodes the cookie as my%20name=John%20Smith
document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);

console.log(document.cookie); // ...; my%20name=John%20Smith
document.cookie = "user=John; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT"