Meu navegador mostra ${cpf} ${nome} ao invés dos dados propriamente ditos.
cliente.js:
const informacoesClientes = [
{
cpf: 66809433023,
nome: "Jairo"
}, {
cpf: 09166515769,
nome: "Andre"
}
]
const corpoTabela = document.querySelector("[data-conteudo-tabela]")
const exibeCliente = (cpf, nome) => {
const linha = document.createElement('tr')
const conteudoLinha = '<td>${cpf}</td><td>${nome}</td>'
linha.innerHTML = conteudoLinha
return linha
}
informacoesClientes.forEach(indice => {
corpoTabela.appendChild(exibeCliente(indice.cpf, indice.nome))
})
clientes.html:
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous"
/>
<link
href="https://fonts.googleapis.com/css?family=Pacifico&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="clientes.css" />
<title>PetShop!</title>
PetShop!
CPF | Nome | Ações |
---|
<tbody data-conteudo-tabela>
</tbody>
<script src="cliente.js"></script>
<script
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"
></script>