Created
May 24, 2016 12:16
-
-
Save Burick/b5556f6a312bd3537dead8a06bcc85ba to your computer and use it in GitHub Desktop.
Форматирование цены Js
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
/* | |
layerPrice цена которую нужно отформатировать | |
formattedPrice отформатировананя цена | |
*/ | |
var roundedPrice = Math.round(layerPrice) | |
var formattedPrice = (roundedPrice + "").replace(/(\d)(?=(\d\d\d)+$)/, "$1 ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(product.html().replace(/\s/g, '')*2).toString().split('').reverse().join('').replace(/([0-9]{3})/g, "$1 ").split('').reverse().join('')