Hello, I have a small problem, I have a number coming from a sum and I need to assign a mask to that number. I did some tests until it worked though the mask was not correct to the number.
var format = function (format, text) {
var array = text.split("");
return format.replace(/{(.*?)}/g, function (index) {
return array.splice(0, index.replace(/\D/g, "")).join("");
});
};
var texto = format("{3}.{3}.{3}.{3},{2}", trasfN);
document.getElementById('calTotal').value = texto;
alert(texto);
In a test the number is returning this 162.312.0.
and the correct one would be to return 16.231,20*