Removing a note
In this section, you will write the code for removing a note when someone uses that remove
command, and they pass in the title of the note they want to remove. In the previous chapter, we already created some utility functions that help us with fetching and saving notes, so the code should actually be pretty simple.
Using the removeNote function
The first step in the process is to fill out the removeNote
function, which we defined in the previous chapters, and this will be your challenge. Let's remove console.log
from the removeNote
function in the notes.js
file. You only need to write three lines of code to get this done.
Now, the first line will fetch the notes, then the job will be to filter out the notes, removing the one with title of argument. That means we want to go through all of the notes in the notes array, and if any of them have a title that matches the title we want to remove, we want to get rid of them. And this can be done using the notes.filter
function we used...