Skip to content

Instantly share code, notes, and snippets.

View anton-mladenov's full-sized avatar
🎲
gambling with git

Anton Mladenov anton-mladenov

🎲
gambling with git
View GitHub Profile
var addToLocalStorageArray = function (name, value) {
// Get the existing data
var existing = localStorage.getItem(name);
// If no existing data, create an array
// Otherwise, convert the localStorage string to an array
existing = existing ? existing.split(',') : [];
// Add new data to localStorage Array