Skip to content

Instantly share code, notes, and snippets.

@cristofer-dev
Created June 12, 2017 20:20
Show Gist options
  • Save cristofer-dev/9f27f0ed68b0d67c9c073222d7669b31 to your computer and use it in GitHub Desktop.
Save cristofer-dev/9f27f0ed68b0d67c9c073222d7669b31 to your computer and use it in GitHub Desktop.
Formatea un numero segun punto o coma y separado por miles
var number = 46786.62;
// sin parámetros será el formato por defecto de tu navegador
console.log("Formato automático --- " + number.toLocaleString());
// le puedes pasar un código de locale específico
console.log("Formato en EE.UU. ---- " + number.toLocaleString("en-US"));
console.log("Formato de España ---- " + number.toLocaleString("es-ES"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment