К основному контенту

Аналог php функции number_format на javascript




 function number_format (number, decimals, decPoint, thousandsSep) {
    number = (number + '').replace(/[^0-9+\-Ee.]/g, '')
    var n = !isFinite(+number) ? 0 : +number
    var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
    var sep = (typeof thousandsSep === 'undefined') ? ',' : thousandsSep
    var dec = (typeof decPoint === 'undefined') ? '.' : decPoint
    var s = ''

    var toFixedFix = function (n, prec) {
        var k = Math.pow(10, prec)
        return '' + (Math.round(n * k) / k)
        .toFixed(prec)
    }

    s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.')
    if (s[0].length > 3) {
        s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep)
    }
    if ((s[1] || '').length < prec) {
        s[1] = s[1] || ''
        s[1] += new Array(prec - s[1].length + 1).join('0')
    }
    return s.join(dec)
}


Комментарии

mkjc25q3em написал(а)…
Red Dog Casino is a new new} on-line on line casino that’s got over 200 high-quality slot video games, where the stakes can be as little as you need – and the wins as excessive because the sky. They’ve applied strict standards, corresponding to the standard of the video games and bonuses, and they’ve reviewed each one in-depth assist you|that will assist you|that can help you} decide which playing sites are the right ones for you. Our group of iGaming specialists have created this bumper evaluate information of the highest 10 greatest on-line playing sites you could be a part of at present. To keep away from issues, issues, and misplaced income, operators ought to think of making a page answering frequently requested questions and describing everything that might curiosity players. This part can embody any technical, organizational, and authorized matter and assist players by way of their issues, explaining each step of how to to|tips on how to} clear up them. There wants to|must also} be a well mannered, skilled, and responsive participant 메이저사이트 support service that will at all times react to any users’ wants or questions and information players by way of the platform.

Популярные сообщения из этого блога

Сон, усталость и эффективность - есть связь!

Не зря треть жизни мы проводим во сне...

Удаление всех запущенных контейнеров

Для остановки/удаления всех запущенных контейнеров можно использовать следующие команды Остановить: docker stop $ ( docker ps - a - q ) Удалить: docker rm $ ( docker ps - a - q )

Что за место?