#100DAYSOFCODE Day69

#100DAYSOFCODE Day69

Learn about Javascript Cookies

Cookies in the browser are small strings that contain key value pairs of information. Most of the time they are sent from the web server to the browser. The browser will save them in a secure area connected to the current domain. They are typically used to save settings for session management, personalization or for tracking a user's actions and movement on a website. This video covers how to work with cookies in the browser and also how you can create, delete or edit them from within the browser with JavaScript.

Screen Shot 2021-05-11 at 12.02.46 AM.png P.S. capacity have improve a lot now

document.cookie = "hello=true";
document.cookie = "doSomethingOnlyOnce=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
document.cookie = "person=beau; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/"

Delete cookie:
document.cookie = "person=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";

console.log(document.cookie)