In the previous lesson, we saw how we can remove an item from our list by pressing delete, and what
we're doing is we're just rebuilding the list and because we're rebuilding the list every time, it's
based on the array, which is contained within my list.
So if we add something and if we want to add something, it's as easy as updating our array and then
launching build again.
So we want to push an item to our list.
We can select the contents that's contained within the ADD item variable.
So taking another value, we're going to select that object.
And this is going to be our new item and selecting using query selector, we're going to select the
element with add item as the value and then we just need to get the value from that input.
So we'll check to see if that one has a value.
And if it does, then we're going to add it into our list.
And if it doesn't, then we're not going to do anything because we don't want to add any blank values
in there.
So let's try that.
It's and now we do add item.
We all we get is clicked.
If we do test, we're adding it into our list.
And then lastly, we still need to rebuild our list.
So whenever we push content into our array, we want to rebuild our list.
So if I do test, you see test gets added in there and it's got the same functionality that we had earlier.
So we've got the delete.
We can add as many of them as we want.
And then of course, we can delete as many as we want as well as again, we're just simply rebuilding
that array.
So whatever contents are in the array is what's going to get output when we launched the function build.
So the next thing that we want to do and the last thing that we want to do is have the ability to edit
that content so well, if you got something in the list, you don't want to delete it.
You don't want to add a new item, you want to edit it.
So it's going to be a little bit trickier, but still possible.
And we're going to do it cut the same way as we did with the event listener that we added into the span
as we're creating them.
Except this time we need to have the ability to edit it.
So that's coming up in the next lesson.