I can´t solve this task. My code is: export const formatTaskList = (tasks) => {for(let i=0; i<tasks.length; i++) { if(tasks.status ==='DONE') { tasks = '\u2705'+" "+ tasks.title } else {tasks = '\u274c'+" "+tasks.title } } return tasks; }
akntov the big problem that you have here is in this line:
tasks = '\u2705'+" "+ tasks.title
tasks - is an array. tasks[i] - is an individual item of this array when you're iterating over it with a for loop.
tasks
tasks[i]
for
Yes. Is an array. I can´t solve step 5. I don´t understand "nice code."
My code: export const formatTaskList = (tasks) => { for(let i=0; i<tasks.length; i++) { if(tasks.status =='DONE') { tasks= \u2705 ${Object.keys(tasks[i])[1]} ${tasks[i].title} ; } else { tasks= \u274c ${(Object.keys(tasks[i])[1])} ${tasks[i].title}; } } return tasks }
\u2705 ${Object.keys(tasks[i])[1]} ${tasks[i].title}
\u274c ${(Object.keys(tasks[i])[1])} ${tasks[i].title}
akntov as it's an array, it should remain an array.
With the statement tasks= you're overwriting the whole array, not just the individual items of it.
tasks=
Try a different approach. Create a new array and add elements to it using the push function.
push
Coderslang_Master Thanks!