How to parse 20 digit number using JavaScript and jQuery

A 20-digit number is generally too big for a JavaScript native numeric type, so you’ll need to find a “big number” package to use. Here’s one that I’ve seen mentioned on Stack Overflow and that looks interesting: http://silentmatt.com/biginteger/

That one is just integers. If you need decimal fractions too, you’ll have to find something else.

If you just want to check that a 20-digit string looks like a number, and you don’t need to know the value, you can do that with a regular expression.

Leave a Comment