Not sure how to create model for this codes of java script. need to display a list with saved names and then be able to select favorute
function showFavorites() {
favoritesList = JSON.parse(localStorage.getItem("saveData"));
fetch(favoritesList[0].url)
.then(response => response.json())
.then(data => {
console.log(data);
});
}
function saveFavorites(item) {
var flag = false;
for (let i = 0; i < savedLaunches.length; i++) {
if (savedLaunches[i].url == item.url) {
flag = true;
}
}
if (flag) {
return;
}
savedLaunches.push(item);
localStorage.setItem("saveData",JSON.stringify(savedLaunches));
}