localStorage [object object]

localStorage [object object]
0

#1

When I click on a checkbox it will pass an id and text, but looking at the localStorage I see [object object]. I know the typeof storage is object and should be an array. The question from my side is, how should I turn an object into an array?

	function addFavorite(jokeId, jokeText) {
		let storage = localStorage.getItem('favoList') || [];
		let norrisJoke = {
			id: jokeId,
			joke: jokeText
		};
		console.log(norrisJoke);
		storage.push(norrisJoke);
		console.log(typeof storage);
		localStorage.setItem('favoLis', norrisJoke);
    }

#2

9 posts were merged into an existing topic: Push is not a function


#3