1// Save data to sessionStorage
2sessionStorage.setItem('key', 'value');
3
4// Get saved data from sessionStorage
5let data = sessionStorage.getItem('key');
6
7// Remove saved data from sessionStorage
8sessionStorage.removeItem('key');
9
10// Remove all saved data from sessionStorage
11sessionStorage.clear();
12
1 var setsession = window.sessionStorage.setItem("animals", "cat");
2 var getsession = window.sessionStorage.getItem("animals");
3 console.log(getsession);
1//localStorage - stores data with no expiration date. window. sessionStorage - stores data for one session (data is lost when the browser tab is closed)
2