How can I format positive and negative numbers using a comma separator every three digits by jQuery? I surf the internet but all the answers just about positive numbers. thanks.
Asked
Active
Viewed 111 times
0
-
if you fixed your problem, plz share your solution. if my answer helped you, I would appreciate if you accept my answer – R Pasha Jul 13 '20 at 17:21
1 Answers
1
check out Number.prototype.toLocaleString()
console.log((2000000).toLocaleString())
console.log((-2000000).toLocaleString())
R Pasha
- 695
- 5
- 21