TypeScript – Number toLocaleString()

 Locale

This method converts a number object into a human-readable string representing the number using the locale of the environment.

Syntax

number.toLocaleString()

Return Value

Returns a human-readable string representing the number using the locale of the environment.

Example

var num = new Number(177.1234); 
console.log( num.toLocaleString());

On compiling, it will generate the same code in JavaScript.

The code will produce the following output −

177.1234

Previous page:-Click Here

Leave a Reply