curriculum/challenges/english/blocks/review-local-storage-and-crud/6723d0ac516099c902394e8b.md
GET Method: This is used to fetch data from a server.POST Method: This is used to submit data to a server which creates a new resource.PUT Method: This is used to update a resource by replacing it entirely.PATCH Method: This is used to partially update a resource.DELETE Method: This is used to remove records from a database.localStorage and sessionStorage PropertieslocalStorage and sessionStorage properties.localStorage Property: localStorage is the part of the Web Storage API that allows data to persist even after the browser window is closed or the page is refreshed. This data remains available until it is explicitly removed by the application or the user.localStorage.setItem() Method: This method is used to store a key-value pair in localStorage.localStorage.setItem('username', 'Jessica');
localStorage.getItem() Method: This method is used to retrieve the value of a given key from localStorage.localStorage.setItem('username', 'codingRules');
let username = localStorage.getItem('username');
console.log(username); // codingRules
localStorage.removeItem() Method: This method is used to remove a specific item from localStorage using its key.localStorage.removeItem('username');
localStorage.clear() Method: This method is used to clear all of the stored data in localStorage.localStorage.clear();
sessionStorage Property: Stores data that lasts only for the current session and is cleared when the browser tab or window is closed.sessionStorage.setItem() Method: This method is used to store a key-value pair in sessionStorage.sessionStorage.setItem('cart', '3 items');
sessionStorage.getItem() Method: This method is used to retrieve the value of a given key from sessionStorage.sessionStorage.setItem('cart', '3 items');
let cart = sessionStorage.getItem('cart');
console.log(cart); // '3 items'
sessionStorage.removeItem() Method: This method is used to remove a specific item from sessionStorage using its key.sessionStorage.removeItem('cart');
sessionStorage.clear() Method: This method is used to clear all data stored in sessionStorage.sessionStorage.clear();
document.cookie:document.cookie = "organization=freeCodeCamp; expires=Fri, 31 Dec 2021 23:59:59 GMT; path=/";
To delete a cookie, you can set its expiration date to a time in the past.
document.cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
Review the Local Storage and CRUD topics and concepts.