scrimba
Frontend Career Path
Making websites interactive
Chrome Extension
Refactor the app to use a template string
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

Refactor the app to use a template string
AboutCommentsNotes
Refactor the app to use a template string
Expand for more info
index.js
run
preview
console
let myLeads = []
const inputEl = document.getElementById("input-el")
const inputBtn = document.getElementById("input-btn")
const ulEl = document.getElementById("ul-el")

inputBtn.addEventListener("click", function() {
myLeads.push(inputEl.value)
inputEl.value = ""
renderLeads()
})

function renderLeads() {
let listItems = ""
for (let i = 0; i < myLeads.length; i++) {
// Refactor the code below to use a template string
listItems += "<li><a target='_blank' href='" + myLeads[i] + "'>" + myLeads[i] + "</a></li>"
}
ulEl.innerHTML = listItems
}
Console
/index.html
-1:12