kaciczak0211 / TODO-LIST

1 stars 0 forks source link

Improvement for keeping only unique values in the list #1

Open EugeneHerasymchuk opened 2 years ago

EugeneHerasymchuk commented 2 years ago

To be able to control our list of values unique let's first keep this list on JS level, because currently, every value that goes from user - immediately is being applied to the HTML. Let's not remove anything, just add a new, empty array, let's name it currentTodoItems. 1) Then inside addTodo(), we need to add ( .push() ) item to the list, 2) we also need to add functionality for removing item from array, so inside method deleteCheck() please find and remove value from Array currentTodoItems.

EugeneHerasymchuk commented 2 years ago

3) the last improvement that will allow us to have a list only with unique values - you need to add a check in the beginning of the addTodo() method to find the value that user wants to add inside the list currentTodoItems. If this value is already there - return from the method, so this will not be added.

If you want, you can use for example method alert to tell user that only unique values are allowed before you will return from the method

EugeneHerasymchuk commented 2 years ago

I propose to cover the topic of Array to get this task done: resources: https://www.codingame.com/playgrounds/6181/javascript-arrays---tips-tricks-and-examples

https://javascript.info/array

there is a series of links, please cover all of them: https://www.digitalocean.com/community/tutorial_series/working-with-arrays-in-javascript

understand - what is Array, what we can store there, how it's used in applications