Pontos Milhar com JS
by Rômulo Bastos
HTML
<h1>Pontuação (milhar)</h1>
<p>
<span class="fw-bold highlight" id="clientes">25826555</span> clientes
</p>
CSS
body {
font-family: 'sans-serif';
}
.fw-bold {
font-weight: 700;
}
.highlight {
background-color: #FFDDAA;
padding: 4px 8px;
margin: 0 5px;
border-radius: 4px;
}
JavaScript
function pontosMilhar(el, num) {
el.innerHTML = parseInt(num).toLocaleString('pt-BR');
}
let clientesElem = document.querySelector('#clientes');
let clientes = clientesElem.innerHTML;
pontosMilhar(clientesElem, clientes);