I've got a web page that displays decimals in a user's localized format, like so:
- English:
7.75
- Dutch:
7,75
If I add two number variables together in JavaScript on my machine (where the numbers are taken from strings in the above formats) I get the following results:
- English:
7.75 + 7.75 = 15.5
- Dutch:
7,75 + 7,75 = 0
If I was to run this code on a Dutch users machine, should I expect the English-formatted addition to return 0
, and the Dutch-formatted addition to return 15,5
?
In short: Does the JavaScript calculation use local decimal separators in its string to number conversions?