January 2018
Beginner
658 pages
13h 10m
English
In our case, we are repeating ourselves. It would be best to break this out into a function that we can call from both places. In order to do this, all we're going to do is make a function in notes.js called logNote.
Now, in notes.js, down following the removeNote function, we can make that brand new function a variable called logNote. This is going to be a function that takes one argument. This argument will be the note object because we want to print both the title and the body. As shown here, we'll expect the note to get passed in:
var logNote = (note) => {};
Now, filling out the logNote function is going to be really simple, especially when you're solving a DRY issue, because you can simply take the code that's ...
Read now
Unlock full access