how to setItem and getItem in javascript in localStorage
function set(){
var sendJSON = JSON.stringify(allMovie);
localStorage.setItem('allMovie',sendJSON)
}
function get(){
var getJSON = localStorage.getItem('allMovie');
if (getJSON){
allMovie = JSON.parse(getJSON)
}
}//localStorage is an object, so values are stored by key name
//data from localStorage is always stored in strings
//usually the values at each key are stringified objects in JSON format, therefore we must parse them
var data = JSON.parse(localStorage.getItem("key name"));//make sure the "key name" exists in the localStoragevar KeyName = window.localStorage.key(index);localStorage.getItem('bgcolor');
Also in JavaScript:
- can we add jquery in chrome extension js code
- break string to array javascript without delimeter
- javascript for loop that prints 10 times
- webslesson search bar ajax
- react array if id is present do not add element
- update nodejs
- js window location relative path
- node js check if called from command line
- node sass version react
- express js redirect to url
- hoe lang is 50000 uur
- ionic capacitor splash screen spinner
- how to draw a triangle using javascript
- pause console debugger in react
- iframe reload parent page
- jspdf reduce size file
- react style ternary operator
- appendchild element once if element presense in js
- trigger hover event javascript
- javascript object freeze
- custom font in react native
- remove accesnt and simbols and paranthesis from text js
- js array.splice first element
- pdfjs customizing viewer.html js event handler