let nextValue; for (let i = 0; i < localStorage.length; i++){ nextValue = localStorage.getItem(localStorage.key(i)); //Do something with nextValue.. //... }