-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.js
More file actions
31 lines (29 loc) · 667 Bytes
/
Copy path1.js
File metadata and controls
31 lines (29 loc) · 667 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
28
29
30
31
// 1번
const todos = [
{ id: 3, content: 'HTML', completed: false },
{ id: 2, content: 'CSS', completed: true },
{ id: 1, content: 'Javascript', completed: false },
];
const render = todos =>
todos
.map(
({ id, completed, content }) =>
`<li id="${id}">
<label>
<input type="checkbox"${completed ? ' checked' : ''}>${content}
</label>
</li>`
)
.join('');
console.log(render(todos));
/*
<li id="3">
<label><input type="checkbox">HTML</label>
</li>
<li id="2">
<label><input type="checkbox" checked>CSS</label>
</li>
<li id="1">
<label><input type="checkbox">Javascript</label>
</li>
*/