Random Flashcards
1
Q
What is local storage?
A
Local Storage is an API. It is a property that allows you to store data across browser sessions; you can leave the browser and come back and the data will still be there for you to continue working.
2
Q
What is session storage?
A
sessionStorage is similar to localStorage ; the difference is that while data in localStorage doesn’t expire, data in sessionStorage is cleared when the page session ends.
3
Q
With localStorage, what are the big 4 methods?
A
- Put item into local storage
localStorage.setItem(“bestFriend”, “Bob”) - Get item out of local storage
localStorage.getItem(“bestFriend”, “Bob”) - Remove item in local storage
localStorage.removeItem(“bestFriend”, “Bob”) - Remove all from local storage
localStorage.clear()
4
Q
What are some practice uses of localStorage?
A
When a user is filling out a long form, keep the data in localStorage so that in case user accidentally exited out, we still have the data
5
Q
A