# JS number format

## Problem

To format the number (120000) into (120,000) you have a simple built-in function in PHP **number_format()**. But you can't do that this simple in Javascript.

## Solution

You can simply call the following Javascript function to format the number.

It accepts 4 parameters:

- The number that needs to be formatted.
- After how many digits the decimal will be placed.
- The decimal point symbol (default is "." dot)
- The thousand separator (default is "," comma)