I have code javascript:
valueToBelocl = 9876543210123456;
modLocale = "en-US";
valueToBelocl = valueToBelocl.toLocaleString(modLocale);
ressult: 9,876,543,210,123,460
Expected:9,876,543,210,123,456
Please help me make correct result! Thanks!
I have code javascript:
valueToBelocl = 9876543210123456;
modLocale = "en-US";
valueToBelocl = valueToBelocl.toLocaleString(modLocale);
ressult: 9,876,543,210,123,460
Expected:9,876,543,210,123,456
Please help me make correct result! Thanks!
The integer you are using is too long for your JavaScript implementation. You should not use integers larger than Number.MAX_SAFE_INTEGER
, which is 9,007,199,254,740,991
on most engines today.
If you want to work with large integers, you should use specific libraries. This won't really help you with formatting it out-of-the-box though.