Skip to content

Commit

Permalink
Add function to retrieve notes from local storage (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Liendo authored Jan 16, 2024
1 parent dd6a480 commit 856fdea
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,15 @@ function createNote(title, description, date) {
const noteObjectString = JSON.stringify([...lastNotes, note]);

localStorage.setItem('notes', noteObjectString);
console.log('main.js');
}

/**
* función para obtener las notas del localstorage
* @returns {Array} notas
*/
function obtenerNotas() {
const notas = JSON.parse(localStorage.getItem('notas') ?? '[]');

return notas;
}

0 comments on commit 856fdea

Please sign in to comment.