Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

local storage javascript array

//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
Comment

localstorage javascript array

// 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);
Comment

PREVIOUS NEXT
Code Example
Javascript :: Reverse numbers from an array in javascript 
Javascript :: regular expression for thousand separator 
Javascript :: expressjs 
Javascript :: react fetch custom hook 
Javascript :: Min Stack Algorithm JS 
Javascript :: javascript check if null 
Javascript :: js check if is array 
Javascript :: add id attribute to jQuery steps 
Javascript :: get data from formdata 
Javascript :: javascript prime number 
Javascript :: install react router dom with npm 
Javascript :: table sort datatable 
Javascript :: javascript get gps location 
Javascript :: why is my req.body empty 
Javascript :: vuex add multiple payload to mutation 
Javascript :: jquery button top to bottom 
Javascript :: onselect javascript 
Javascript :: firestore javascript delete document 
Javascript :: react native floating button 
Javascript :: for of loop javascript 
Javascript :: js largest number in array 
Javascript :: javascript get parent by tag 
Javascript :: javascript consecutive numbers in array 
Javascript :: how to send query parameters in url vuejs 
Javascript :: nestjs vscode debug 
Javascript :: javascript queryselector child element 
Javascript :: how to iterate over list in jquery 
Javascript :: sequelize init connection set up nodejs node 
Javascript :: how to hide title bar react-navigation 
Javascript :: react form submit values with name 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =