STORING DATA IN WEBPAGES

Internet ‘Fortune cookies’ right inside your browser

Ever opened a random webpage and the first thing you’re greeted with is cookie? They are not edible so what’s their purpose??!

Data in Web storage and cookies can be viewed in the application section of dev tools with Shift + Ctrl + J on windows.
localStorage.setItem(Key, Value) — Save data into local storagelocalStorage.getItem(Key) — Get data from inside local storagelocalStorage.removeItem(Key) — Remove data from storage
localStorage.setItem(‘propertyName’,’value’);localStorage.getItem(‘propertyName’);localStorage.removeItem(‘propertyName’);
let stringCart= JSON.stringify(firstCart) /*convert fifthCart object to string*/localStorage.setItem(‘item’, stringCart) /*store “string” to localstorage*/let objCart= JSON.parse(localStorage.getItem(‘item’)) /*convert string back to object*/
setItem(key, value)getItem(key)removeItem(key)clear()key(index)length

--

--

Frontend enginer, UI enthusiast, Technical support, Smart contract developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Efienemokwu James

Frontend enginer, UI enthusiast, Technical support, Smart contract developer