.DS_Store
# understand-javascript-arrays
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Plunker</title>
<style>
.task-list {
color: black;
}
.task-list--completed {
color: lightgray;
}
</style>
</head>
<body>
<ul class="task-list"></ul>
<script src="script.js"></script>
</body>
</html>
// Array.prototype.some()
var tasks = [
{
title: 'Do laundry',
completed: true
},
{
title: 'Feed the cat',
completed: true
},
{
title: 'Watch the array lessons on egghead.io',
completed: true
}
];
var list = document.querySelector('.task-list');
list.classList.add(
tasks.some(task => task.completed === false)
? 'task-list--uncompleted'
: 'task-list--completed'
);
list.innerHTML = tasks
.map(x => x.completed ? `<s>${x.title}</s>` : x.title)
.map(x => `<li>${x}</li>`)
.join('');