Open geekingreen opened 4 years ago
what does 'accept' mean? Accept as an argument or inside the function itself?
Argument
Ok that was throwing me off I thought so but that clarifys things
On Sat, Mar 7, 2020, 6:02 PM Isaac Gifford notifications@github.com wrote:
Argument
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bhans23/Another-JS-Todo-List/issues/4?email_source=notifications&email_token=ANVG3IE3MPHFARIWHYSB44LRGLVC7A5CNFSM4LDHEJK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOEJMZY#issuecomment-596153959, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANVG3IF4I3766MPOQ6WS27TRGLVC7ANCNFSM4LDHEJKQ .
Can you take a look at the createListFunction branch and give me some hints? I'm missing some key concepts so If you could identify those and point me in the right direction that would be great. Thank you
Ok so it should be more like:
document.getElementById('list').appendChild(TodoList(items));
and the pseudo code for TodoList and TodoItem would be something like:
TodoItem = item => input = new input with type checkbox and checked value of item span = new span with innerText title of item li = new list item appended with input/span return li
TodoList = items => todoList = list element todoList.append(items.map(TodoItem))
Ick I still am having issues. But I think I'm getting closer
Create a function called TodoList and a function called TodoItem.
TodoList should accept an array of items to initially populate the list, this should be an array of objects that contain a
title
and achecked
property. TodoList should create the list element, use the array and TodoItem function to generate the nodes and append them to the list element.TodoItem should accept an object containing the properties mentioned above and create an li with an input of type checkbox mapped to the checked value, and a span with the value of title. The appearance of which should be something like
[ ] Something on my todo list
The final step is to call TodoList, passing it an array of objects with the aforementioned properties and append that to the div with the id
list
;