Skip to content

Commit

Permalink
Day 10 - 02
Browse files Browse the repository at this point in the history
  • Loading branch information
teiResa committed Jun 26, 2024
1 parent dec287e commit 7475715
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
44 changes: 40 additions & 4 deletions scrimba/proj/js/leads.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,51 @@
let inputEl = document.getElementById("input-el")
let myLeads = []
//https://v2.scrimba.com/learn-javascript-c0v/~03s/



const inputEl = document.getElementById("input-el")
let myLeads = [
// "dummy data" is put temperarily to help with set-up
"google.com", "applejacks.com", "greatlead.cn.co"
]
const ulEl = document.getElementById("ul-el")




/* Is this amature hour? Use the element's id
function input() {
console.log("inputEl clicked")
} */

let inputBtn = document.getElementById("input-btn").addEventListener("click", function(){
console.log("event listener button")
// push the value of the input of input-el (inputEl)

myLeads.push(inputEl.value)


//myLeads.push("www.awesomelead.com")
console.log(myLeads)
})

inputEl = "hihihih"
/* Const vs let
Const is non-rewritable, once declared, the value is it's always value. Let is rewritable, and a let looks like you intend for it to be reassigned.
If possible, use const. Else, use let.
*/


// to render out the items in a n Array, you first need to loop through the items.

for (let i = 0; i < myLeads.length; i++) {
// Not, ulEl.textContent = myLeads[i] , remember it updates while removing the prior value

// ulEl.textContent += myLeads[i] + " "
ulEl.innerHTML += "<li>" + myLeads[i] + "</li>"

}

// write you first innerHTML

// https://v2.scrimba.com/learn-javascript-c0v/~041
4 changes: 4 additions & 0 deletions scrimba/proj/leads.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<i class="far fa-plus-square"></i>
<i class="fas fa-plus"></i>

<hr>

<ul id="ul-el"></ul>




Expand Down

0 comments on commit 7475715

Please sign in to comment.