-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (25 loc) · 764 Bytes
/
Copy pathscript.js
File metadata and controls
27 lines (25 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const creatItem=(todo,id)=>{
let item = `
<li
key="${id}"
class=${todo.checked ? 'taskItem-done' : 'taskItem'}>
${todo.title} ${todo.date ? todo.date:''}
<img class="btn" src="check-icon.png" onclick="completeTodo(event)"/>
<img class="btn" src="delete-icon.png" onclick="deleteTodo(event)"/>
</li>
`
return item
}
const rederTodoItems=()=>{
list.innerHTML = ''
let items = []
// console.log(todosArray.length)
// console.log(Boolean(1))
todosArray.length ?
todosArray.map((todo,id)=>{
items.unshift(creatItem(todo,id))
list.innerHTML=items.join('')
}):
list.prepend('Азыркы учурда тапшырма жок')
}
rederTodoItems()