This is a repository about math APIs.
2018-10-22
LinWei
Achieve some math APIs.
See Math.
Note:
No support to Internet Explorer.
APIs:
Math._pow
Description:
Return the base to the exponent power.
Example:
Math._pow(2, 3)
// => 8
Math._pow(4, 0.5)
// => 2
Math._sqrt
Description:
Return the square root of a number.
Example:
Math._sqrt(16)
// => 4
Math._sqrt('0x10')
// => 4
Math._sqrt(-1)
// => NaN
Math._toHex
Description:
Convert a number to hexadecimal sequence.
Example:
Math._toHex(64)
// => '40'
Math._toHex(NaN)
// => '0'