(index)
| 97 | |
| 98 | // Function to delete a note |
| 99 | function deleteNote(index) { |
| 100 | let notes = localStorage.getItem("notes"); |
| 101 | if (notes == null) { |
| 102 | notesObj = []; |
| 103 | } else { |
| 104 | notesObj = JSON.parse(notes); |
| 105 | } |
| 106 | notesObj.splice(index, 1);//to remove a note from array |
| 107 | localStorage.setItem("notes", JSON.stringify(notesObj)); |
| 108 | showNotes(); |
| 109 | } |
| 110 | |
| 111 | //searching for notes |
| 112 | let search = document.getElementById('searchTxt'); |