scrimba
Note at 0:56
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Note at 0:56
Expand for more info
index.js
run
preview
console
const items = ["Candles", "Decorations", "Chocolate"]
const checklist = document.getElementById("checklist")

// Task:
// - For each item in the items array, create a div with a class of "checklist-item", which contains a checkbox input and corresponding label.
// - Make sure that the shopping list can render a checkbox for all the items, even if new items are added to the items array.

const handleList = (items) => {
items.forEach(item => {
const listItem = `<label><input type="checkbox"></input>&nbsp;${item}</label>`
checklist.innerHTML += listItem
})
}

handleList(items)

// Stretch goals:
// - Add an input which allows the user to add more items.
// - Add a delete button for the items.

Console
/index.html
LIVE