February 2018
Intermediate to advanced
298 pages
8h 22m
English
To create a key-value pair inside the sessionStorage object, you can use the setItem method, similar to the localStorage object. Just like localStorage, sessionStorage is also a synchronous API, so you can be sure that you'll immediately have access to whatever values you're storing.
Adding an item to session storage is just like working with local storage, as shown in the following snippet:
sessionStorage.setItem('my key', 'awesome value');console.log('Added to session storage');
Read now
Unlock full access