17 lines
586 B
JavaScript
17 lines
586 B
JavaScript
const todos = [
|
|
{ text: "play mariokart", author: "shaun" },
|
|
{ text: "buy some milk", author: "mario" },
|
|
{ text: "buy some bread", author: "luigi" }
|
|
];
|
|
|
|
// console.log(JSON.stringify(todos));
|
|
// mithilfe der stringify Methode, convert man das Feld des Objektes als JSON String
|
|
localStorage.setItem("todos", JSON.stringify(todos));
|
|
|
|
// speichert man das todos Object als json String
|
|
const stored = localStorage.getItem("todos");
|
|
|
|
// Die Ausgabe des Felds mit Objekten
|
|
console.log(todos)
|
|
// Die Ausgabe des Felds mit Objekten als json String
|
|
console.log(store) |