Numeral.js – formatting numbers in JavaScript

Do you love math, or don’t like? In JavaScript it doesn’t matter, as we can work with numbers and formatting so easy, using the Numeral.js – a great library for formatting numbers in JavaScript.

A library for formatting numbers in JavaScript

Numeral.js library brings to us great features about format and manipulate numbers. They can be formatted to look like currency, percentages, times, or even plain old numbers with decimal places, thousands, and abbreviations.

JS library for manipulating and formatting numbers
JS library for manipulating and formatting numbers

Usage

1. Include library from local files

<script src="numeral.min.js"></script>

or include from cdnjs.com

<script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/1.4.5/numeral.min.js"></script>

In node.js:

npm install numeral

var numeral = require(‘numeral’);

Format something

var string = numeral(1000).format('0,0');
// '1,000'

GitHub:

https://github.com/adamwdraper/Numeral-js

Project homepage:

http://numeraljs.com

Everything counts!

Share:Share on Facebook1Share on Google+1Tweet about this on TwitterShare on LinkedIn1Pin on Pinterest0