0

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.

  • 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 Answers1

1

check out Number.prototype.toLocaleString()

console.log((2000000).toLocaleString())
console.log((-2000000).toLocaleString())
R Pasha
  • 695
  • 5
  • 21