// Store an array in local storage // The array to store var array = [1, 2, 3]; // Store after JSON stringifying (is this a verb?) it localStorage.setItem('myArray', JSON.stringify(array)); // Get an array from local storage // Retrieve the array from local storage var array = localStorage.getItem('myArray'); // Parse it to something usable in js array = JSON.parse(array);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter