const formulario = document.getElementById("formulario")
const arr = []
formulario.addEventListener("submit", (event)=>{
event.preventDefault()
const elName = event.target.elements['elName']
const elQtd = event.target.elements['elQtd']
elementCreate(elName.value, elQtd.value)
elName.value = ""
elQtd.value = ""
})
function elementCreate(name, qtd) {
const elNewItem = document.createElement('li')
elNewItem.classList.add("item")
const qtdItem = document.createElement('strong')
qtdItem.innerHTML = qtd
elNewItem.appendChild(qtdItem)
elNewItem.innerHTML += name
const list = document.getElementById("lista")
list.appendChild(elNewItem)
const itemAtual = {
"elName": name,
"elQtd": qtd
}
arr.push(itemAtual)
localStorage.setItem("item", JSON.stringify(arr))
}