- Fork and clone this repo.
- Complete the following within the
index.js
file.
-
Create an empty array called
currentTodos
-
Create an empty array called
doneTodos
-
Create a function the will show the following on the console:
Current todos: ["Get Dry cleaning", "Review functions", "Review arrays"] Done todos: ["Finish all coded tasks", "Sent important email"]
-
Create a function called
completedTodo
which will recieve a parameter calledtodo
as a string. Remove the first todo that matches from the currentcurrentTodos
list and add it to thedoneTodos
list. -
Create a function called
validateTodo
which will recieve a parameter calledtodo
and returntrue
if the length of the todo was greater than 2, or return false. -
Create a function called
addNewTodo
which will recieve a parameter calledtodo
and add it to thecurrentTodos
if the todo element was validated throughvalidateTodo
function. -
Create a function called
uncheckTodo
which will recieve a parameter calledundo
which is an index of a todo in thedoneTodos
array. Remove the todo on the given index and push it to thecurrentTodos
. -
Create a function called
editTodo
which will recieve three parameters,index
,todoList
andupdatedTodo
and update the correct todo with the new value ofupdatedTodo
.