Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6复习-Number&Math #24

Open
Jsmond2016 opened this issue Mar 20, 2022 · 0 comments
Open

ES6复习-Number&Math #24

Jsmond2016 opened this issue Mar 20, 2022 · 0 comments
Labels
面试 面试题系列

Comments

@Jsmond2016
Copy link
Owner

Number相关

  1. 二进制与八进制数值表示法: 二进制用0b, 八进制用0o
  2. Number.isFinite(i) : 判断是否是有限大的数
  3. Number.isNaN(i) : 判断是否是NaN
  4. Number.isInteger(i) : 判断是否是整数
  5. Number.parseInt(str) : 将字符串转换为对应的数值
  6. Math.trunc(i) : 直接去除小数部分
  7. toFixed(x) 可把 Number 四舍五入为指定小数位数的数字。x 默认为0,最大为20
  8. toPrecision(x) 指定精度的数字格式
  9. toString(radix) 转换为 radix 进制的字符串

Math 相关

  • abs(x) 返回 x 的绝对值。
  • ceil(x) 对数进行上舍入。
  • floor(x) 对 x 进行下舍入。
  • max(x,y,z,...,n) 返回 x,y,z,...,n 中的最高值。
  • min(x,y,z,...,n) 返回 x,y,z,...,n中的最低值。
  • round(x) 四舍五入取整。
  • pow(x,y) 返回 x 的 y 次幂。
  • sqrt(x) 返回数的平方根。
  • random() 返回 0 ~ 1 之间的随机数。
@Jsmond2016 Jsmond2016 added the 面试 面试题系列 label Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
面试 面试题系列
Projects
None yet
Development

No branches or pull requests

1 participant