Talyia Khalid - Selection Project#12
Conversation
RyamAlmalki
left a comment
There was a problem hiding this comment.
Overall, amazing work Taliya. Very proud of you!
| print("\n*********************************************"); | ||
| } | ||
| } | ||
| } else { |
There was a problem hiding this comment.
There is a logical issue with the Edit Note feature. First, let's take a look at the problem...
The user decides to edit note one; however, after editing the note, they receive an "ID not present" error, even though it is present, and the note was edited.

Now, where did the issue arise from?

If you carefully track how it works, you will notice that when the second loop runs, it sends a 'not found' ID because note.id and noteid are no longer equal.
Now, to solve this logical problem, we need to make a small code enhancement. We can use .where instead of a for loop.
| print( | ||
| "Note ID: ${note.id}\nNote name: ${note.title}\nNote Description: ${note.description}"); | ||
| print("\n**********************************************"); | ||
| } else if (i == notes.length - 1) { |
There was a problem hiding this comment.
There is a logical issue with Search Note. It is the same issue as with the Edit Note. Use this as a challenge to try to fix the logical problem. I believe in you.
| print("Note Removed Successfully."); | ||
| print("\n***************************************"); | ||
| break; | ||
| } else if (i == notes.length - 1) { |
There was a problem hiding this comment.
I haven't encountered the issue here because you added the break after deleting the note. However, it's better to use where since using this line of code may not be very readable: `else if (i == notes.length - 1) {
RyamAlmalki
left a comment
There was a problem hiding this comment.
Also, one thing is missing: 'Allow users to search for notes by title and content.' It shouldn't be by ID.

No description provided.