✅ – fateassassin – 18-10 Jun 5
I've got a question, why does the dict i try to push only contain the ID? It just doesnt contain the todo
var todoItems = JSON.parse(localStorage.getItem("todos"));
var id = null;
try{id = todoItems[todoItems.length - 1].id + 1;}
catch{id = 1;}
todoItems.push({
"id": id,
"todo": todo
}
);
alert(JSON.stringify(todoItems)); var todoItems = JSON.parse(localStorage.getItem("todos"));
var id = null;
try{id = todoItems[todoItems.length - 1].id + 1;}
catch{id = 1;}
todoItems.push({
"id": id,
"todo": todo
}
);
alert(JSON.stringify(todoItems));