Persistence with localStorage
Keep the ledger after refresh
Browser memory disappears when a page reloads. localStorage gives a small local-first application durable storage on the same device. Arrays must be serialized to JSON when saved and parsed when loaded.
Parsing can fail if stored data is damaged, so recovery is part of the feature—not an afterthought.
안내
Create loadTransactions with localStorage.getItem and JSON.parse.
힌트: Read STORAGE_KEY, then parse only when raw exists.
어디에 작성하나요?
// Implement loadTransactions(), saveTransactions(), and render().5번째 줄에 작성하세요 — 그 주석 아래, 이미 추가한 코드 다음입니다.
Recover safely with try/catch and return an empty array on failure.
Create saveTransactions(items) with JSON.stringify.
Save after every push and render once on startup.
내 코드
이 단계에서 만들고 싶은 것을 설명해 주시면 코드를 작성해 드릴게요 — 그다음 적용을 클릭하면 에디터에 바로 들어갑니다. 이 단계: Create loadTransactions with localStorage.getItem and JSON.parse.