Skip to content

mendezpvi/ict-top-charts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Top Charts

Top Charts

Screenshot 📷

Screenshot

Links 🔗

Live site URL 👀

Solution in iCodeThis 👀

What I learnt 🤓

.toLocaleString()

This method converts a number into a text string according to the specific locale. This includes number formatting settings and other aspects such as thousands separators and decimals. It is useful for presenting numbers in a format that is familiar to the user based on their geographic location or preferred language.

Basic number format:

const number = 1234567.89;

console.log(number.toLocaleString('en-US'));
// "1,234,567.89"

console.log(number.toLocaleString('de-DE'));
// "1.234.567,89"

Additional options:

const number = 1234567.89;
const options = { style: 'currency', currency: 'USD' };
console.log(number.toLocaleString('en-US', options));
// "$1,234,567.89"

Author 🔰

✨ Frontend Mentor - @mendezpvi

✨ iCodeThis - @mendezpvi