What is Cookie and local storage

cookie:-

A cookie is a small piece of data that is stored on the user's computer. Cookies are used to store information about the user such as their name, password, and preferences.

Cookies are created using the document.cookie property. This property is used to set, get, and delete cookies.

Session Storage is a type of web storage that allows web applications to store data locally within the user's browser. Unlike cookies, data stored in session storage is specific to the site on which it was created and data is not shared with other sites.

Session Storage is a new feature introduced in HTML5 that allows you to store data locally in the user's browser. Unlike cookies, data stored in session storage is specific to the site on which it was created and data is not shared with other sites.

Local storage is the most recent mechanism. It allows for larger amounts of data to be stored, but the data is not deleted when the browser is closed. Local storage is useful for storing data that the user will need to access later, such as offline data.