The function call looks like:
parseInt(string, radix);
And here's an example:
const a = parseInt("11", 2);
The radix variable says that 11
is in the binary system, or base 2. This example converts the string 11
to an integer 3
.
基数是2,说的是2进制,所以二进制的11,就是十进制的3. It converts a binary number to an integer and returns it
Comments
Post a Comment