scrimba
Frontend Career Path
Making websites interactive
Chrome Extension
Improving the performance of our app
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

To see this lesson you need to be logged in. Joining Scrimba is free and gives you access to 20+ courses.Sign up
Improving the performance of our app
AboutCommentsNotes
Improving the performance of our app
Expand for more info
index.js
run
preview
console
let myLeads = ["www.awesomelead.com", "www.epiclead.com", "www.greatlead.com"]
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)
console.log(myLeads)
})

// 1. Create a variable, listItems, to hold all the HTML for the list items
// Assign it to an empty string to begin with
for (let i = 0; i < myLeads.length; i++) {
// 2. Add the item to the listItems variable instead of the ulEl.innerHTML
ulEl.innerHTML += "<li>" + myLeads[i] + "</li>"
}
// 3. Render the listItems inside the unordered list using ulEl.innerHTML



Console
/index.html
-3:17