Created
June 12, 2017 20:20
-
-
Save cristofer-dev/9f27f0ed68b0d67c9c073222d7669b31 to your computer and use it in GitHub Desktop.
Formatea un numero segun punto o coma y separado por miles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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