JSFiddle - React, Tailwind, and code Playground
HTML
<div id ="fav">6987</div>
<div id ="test">6.987</div>
JavaScript
var e = $("#fav");
var n = parseInt(e.text()) + 1;
e.text(n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."));
var test = $("#test");
var a = test.text();
console.log("ok ",a);
var r = test.text().replace(/./g, "");
console.log("wrong ", r);
var neu = parseInt(test.text().replace(/./g, "")) + 1;
console.log(neu);