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);
}