How to use toLocaleString() and tofixed(2) in JavaScript

How can I do this in JavaScript?

var num = 2046430; 
num.toLocaleString();

will give you "2,046,430";

What I have tried is:

var num = 2046430; 
num.toLocaleString().toFixed(2);

Expected Output

"2,046,430.00"

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.