1// Get the existing data
2var existing = localStorage.getItem('myFavoriteSandwich');
3
4// If no existing data, create an array
5// Otherwise, convert the localStorage string to an array
6existing = existing ? existing.split(',') : [];
7
8// Add new data to localStorage Array
9existing.push('tuna');
10
11// Save back to localStorage
12localStorage.setItem('myFavoriteSandwich', existing.toString());
13