Using toLocaleString() doesn’t have expected behaviour.

On the web if you had the number 98768 and converted it to a string with toLocaleString()
it would return "98,768". But in NativeScript it just returns "98768".

Anybody else hit this issue? Why doesn’t it behave the same?



I’m sure this isn’t “the right way” to do it but for now I’m achieving the desired outcome like so.

* assuming number is equal to "98765789"
      .map((number, index, array) => {
        return (index+1) % 3 === 0 && array[index+1] 
            ? `,${number}` 
            : number
*  number is now "98,765,789"


That could be upto your browser locale settings vs mobile’s.


I was thinking it might be something like that. Guess that does make my current solution preferable.