How to parse a 20 digit number using JavaScript and jQuery

How to parse a 20 digit number using JavaScript and jQuery?

+3
source share
3 answers

A 20-digit number is usually too large for the native numeric type of JavaScript, so you will need to find a "large number" package to use. Here the one I saw is mentioned in Qaru and looks interesting: http://silentmatt.com/biginteger/

These are just integers. If you need decimals, you have to find something else.

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

+2

Number() parseInt ("", [radix]) .

, , , , , . , .

, , http://www.leemon.com/crypto/BigInt.js ( , ). BigInt JavaScript BigMath.

: ( , "" (int/long )), , , , .

0

JavaScript 20-

20 ( 200 2000) , .

0

Source: https://habr.com/ru/post/1751211/


All Articles