javascript store array in localstorage
//storing array in localStorage
var colors = ["red","blue","green"];
localStorage.setItem("my_colors", JSON.stringify(colors)); //store colors
var storedColors = JSON.parse(localStorage.getItem("my_colors")); //get them back// Guardar el array en el localStorage
// El arreglo:
var array = [1, 2, 3];
// Se guarda en localStorage despues de JSON stringificarlo
localStorage.setItem('myArray', JSON.stringify(array));
// Obtener el arreglo de localStorage
var array = localStorage.getItem('myArray');
// Se parsea para poder ser usado en js con JSON.parse :)
array = JSON.parse(array);
Also in JavaScript:
- run js function after some sec
- store console.timeEnd in variable js
- angular date formats
- javascript math.pow
- rite a function that takes in an array of numbers and outputs the maximum number.
- vuetify change text color of radio button
- jquery add element to array
- javascript append to json
- javascript how to trigger an event
- js num to string with leading 0
- switch javascript
- s3 list objects in folder node js
- detect mouse javascript
- lifecycles if reactjs
- function click anywhere javascript
- npm stop react app
- ngfor index
- foreach await js
- find smallest length string in an array js
- npm numeral
- call js script in html
- javascript schleife
- how to check if a string is alphabetic in javascript
- left_field in jsgrid