My challenge in creating a todo's application for a JS course is to use scripts to create new elements and textContent, and then serve to browser. My scripts are creating the elements, but not displaying the text in the browser.
const todos = [{
title: 'make bed',
completed: true
}, {
title: 'shower',
completed: false
}, {
title: 'shave',
completed: true
}, {
title: 'feed the cat',
completed: false
}, {
title: 'crush the day',
completed: false
}]
const incompleteTodos = todos.filter(function (todo) {
return !todo.completed
})
const summary = document.createElement('h2')
summary.textContext = `You have ${incompleteTodos.length} todos left`
document.querySelector('body').appendChild(summary)
todos.forEach(function (todo) {
const p = document.createElement('p')
p.textContent = 'todo.text'
document.querySelector('body').appendChild(p)
})
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>Todos</h1>
<script src ="todos-app.js"></script>
</body>
</html>
