Skip to content

Instantly share code, notes, and snippets.

View sebackend's full-sized avatar
🏠
Working from home

Sebastián Estrada sebackend

🏠
Working from home
  • Santiago, Chile
View GitHub Profile
@sebackend
sebackend / format-number.js
Last active March 2, 2017 19:17
Dar formato a los números en JS, retorna un String
function formatoNumero(numero, decimales, separadorDecimal, separadorMiles) {
var partes, array;
if (!isFinite(numero) || isNaN(numero = parseFloat(numero))) {
return "";
}
if (typeof separadorDecimal === "undefined") {
separadorDecimal = ",";
}
if (typeof separadorMiles === "undefined") {