0

HTML 5

Who can explain this awful things with very poor explanation? Working with Values The syntax for web storage for both local and session storage is very simple and similar. The data is stored as key/value pairs. Storing a Value: localStorage.setItem("key1", "value1"); Getting a Value: //this will print the value alert(localStorage.getItem("key1")); Removing a Value: localStorage.removeItem("key1"); Removing All Values: localStorage.clear(); The same syntax applies to the session storage, with one difference: Instead of localStorage, sessionStorage is used. What is key and what is value? Did not understand anything in this lesson.

24th May 2018, 9:08 PM
Pavel
1 Resposta
0
- A key/value pair is a set of two linked data items: a key, which is a unique identifier, and a value, which is the data associated with that key. Together, they form an entry in a collection or data structure. - HTML5 introduced web storage, which provides a way for web applications to store data locally within the user's browser. There are two types of web storage: local storage and session storage. - To store a value in web storage, you use the setItem method. This method takes two parameters: the key and the value. - To retrieve a value from web storage, you use the getItem method. This method takes the key as a parameter and returns the corresponding value. -To remove all values from web storage, you use the clear method. This method removes all key/value pairs from storage. For more detail, visit: https://www.freecodecamp.org/news/how-web-storage-works/
20th Apr 2024, 6:05 AM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar