JAVASCRIPT
function apDesc(lc, qtos, gar, tot, qde) {
this.lc = lc;
this.qtos = qtos;
this.gar = gar;
this.tot = tot;
apVenda.apply(this, [lc, qtos, gar, tot, qde]);
// apVenda.apply(this, arguments);
}
function apVenda(lc, qde) {
(this.lc = lc), (this.qde = qde);
}
const lcRelatorio = new apDesc("Zona Sul", 3, 1, 12, 7);
const tabelaRelatorio = `<tr>
<td>${lcRelatorio.lc}</td>
<td>${lcRelatorio.qtos}</td>
<td>${lcRelatorio.gar}</td>
<td>${lcRelatorio.tot}</td>
<td>${lcRelatorio.qde}</td>
</tr>`;
const relatorio = document.querySelector("#relatorio");
relatorio.insertAdjacentHTML("afterbegin", tabelaRelatorio);
HTML
<table>
<thead>
<tr>
<th>Local</th>
<th>Quartos</th>
<th>Garagem</th>
<th>Total</th>
<th>Vendas
</thead>
<tbody id="relatorio"></tbody>
</table>
Método applyl() — Exemplo 1
Local |
Quartos |
Garagem |
Total |
Vendas |